From 2b08e8c6b15a120e691835d76a0b4cf2c25dd6f3 Mon Sep 17 00:00:00 2001 From: Florent Morselli Date: Fri, 1 Mar 2024 16:05:48 +0100 Subject: [PATCH] add README and text to homepage --- .env | 4 + Dockerfile => Dockerfile.sav | 0 Procfile | 3 + README.md | 8 +- app.json | 35 + assets/bootstrap.js | 3 +- assets/controllers/hello_controller.js | 2 +- assets/controllers/items_controller.js | 56 ++ composer.json | 6 +- composer.lock | 998 ++++++++++++++++++- config/bundles.php | 4 + config/packages/api_platform.yaml | 18 + config/packages/nelmio_cors.yaml | 10 + config/packages/pwa.yaml | 1 + config/packages/security.yaml | 39 + config/routes/api_platform.yaml | 4 + config/routes/security.yaml | 3 + config/secrets/dev/dev.APP_SECRET.1cf811.php | 3 + config/secrets/dev/dev.decrypt.private.php | 4 + config/secrets/dev/dev.encrypt.public.php | 3 + config/secrets/dev/dev.list.php | 5 + fpm_custom.conf | 3 + importmap.php | 38 + nginx.conf | 70 ++ src/ApiResource/.gitignore | 0 src/Controller/HomepageController.php | 2 +- src/Entity/Item.php | 5 + symfony.lock | 42 + templates/homepage/index.html.twig | 46 +- 29 files changed, 1354 insertions(+), 61 deletions(-) rename Dockerfile => Dockerfile.sav (100%) create mode 100644 Procfile create mode 100644 app.json create mode 100644 assets/controllers/items_controller.js create mode 100644 config/packages/api_platform.yaml create mode 100644 config/packages/nelmio_cors.yaml create mode 100644 config/packages/security.yaml create mode 100644 config/routes/api_platform.yaml create mode 100644 config/routes/security.yaml create mode 100644 config/secrets/dev/dev.APP_SECRET.1cf811.php create mode 100644 config/secrets/dev/dev.decrypt.private.php create mode 100644 config/secrets/dev/dev.encrypt.public.php create mode 100644 config/secrets/dev/dev.list.php create mode 100644 fpm_custom.conf create mode 100644 nginx.conf create mode 100644 src/ApiResource/.gitignore diff --git a/.env b/.env index d55fbce..10634b2 100644 --- a/.env +++ b/.env @@ -28,3 +28,7 @@ APP_SECRET=0aabd8ac1e1554db5b50ca9d54ad796c # DATABASE_URL="mysql://app:!ChangeMe!@127.0.0.1:3306/app?serverVersion=10.11.2-MariaDB&charset=utf8mb4" DATABASE_URL="postgresql://app:!ChangeMe!@127.0.0.1:5432/app?serverVersion=16&charset=utf8" ###< doctrine/doctrine-bundle ### + +###> nelmio/cors-bundle ### +CORS_ALLOW_ORIGIN='^https?://(localhost|127\.0\.0\.1)(:[0-9]+)?$' +###< nelmio/cors-bundle ### diff --git a/Dockerfile b/Dockerfile.sav similarity index 100% rename from Dockerfile rename to Dockerfile.sav diff --git a/Procfile b/Procfile new file mode 100644 index 0000000..41a32d0 --- /dev/null +++ b/Procfile @@ -0,0 +1,3 @@ +web: vendor/bin/heroku-php-nginx -C nginx.conf -F fpm_custom.conf public/ +# release: bin/console tailwind:build && bin/console importmap:install && bin/console asset-map:compile + diff --git a/README.md b/README.md index 69e3536..7b0e4ba 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ This application is a PWA (Progressive Web Application) built with Symfony and PHPWA. -## Getting Started +## Getting Started (Docker) ### With Docker @@ -28,6 +28,12 @@ This application is a PWA (Progressive Web Application) built with Symfony and P 8. Open `https://localhost:8000` in your favorite web browser 9. Run `symfony server:stop` to stop the server +## Getting Started + +Install Symfony CLI and PostgreSQL + +bin/console d:d:c + ## License It is available under the MIT License. diff --git a/app.json b/app.json new file mode 100644 index 0000000..3700389 --- /dev/null +++ b/app.json @@ -0,0 +1,35 @@ +{ + "name": "phpwa-demo", + "description": "A repo, maybe get this from github", + "keywords": [ + "php", + "symfony" + ], + "repository": "https:\/\/github.com\/survos-sites\/phpwa-demo", + "scripts": { + "dokku": { + "predeploy": "bin/console tailwind:build && bin\/console importmap:install && bin\/console asset-map:compile", + "postdeploy": "" + } + }, + "env": { + "SECRET_TOKEN": { + "description": "A secret key for verifying the integrity of signed cookies.", + "value": "secret" + }, + "WEB_CONCURRENCY": { + "description": "The number of processes to run.", + "generator": "echo 5" + } + }, + "image": "gliderlabs\/herokuish", + "addons": [ + "dokku-postgres", + "dokku-redis" + ], + "buildpacks": [ + { + "url": "https:\/\/github.com\/heroku\/heroku-buildpack-php.git" + } + ] +} diff --git a/assets/bootstrap.js b/assets/bootstrap.js index d4e50c9..193d000 100644 --- a/assets/bootstrap.js +++ b/assets/bootstrap.js @@ -1,5 +1,6 @@ import { startStimulusApp } from '@symfony/stimulus-bundle'; +import Timeago from 'stimulus-timeago' const app = startStimulusApp(); // register any custom, 3rd party controllers here -// app.register('some_controller_name', SomeImportedController); +app.register('timeago', Timeago); diff --git a/assets/controllers/hello_controller.js b/assets/controllers/hello_controller.js index e847027..d96f960 100644 --- a/assets/controllers/hello_controller.js +++ b/assets/controllers/hello_controller.js @@ -11,6 +11,6 @@ import { Controller } from '@hotwired/stimulus'; */ export default class extends Controller { connect() { - this.element.textContent = 'Hello Stimulus! Edit me in assets/controllers/hello_controller.js'; + this.element.textContent = 'Hello, welcome to phpwa-demo!'; } } diff --git a/assets/controllers/items_controller.js b/assets/controllers/items_controller.js new file mode 100644 index 0000000..790d5f2 --- /dev/null +++ b/assets/controllers/items_controller.js @@ -0,0 +1,56 @@ +import { Controller } from '@hotwired/stimulus'; + +/* +* The following line makes this controller "lazy": it won't be downloaded until needed +* See https://github.com/symfony/stimulus-bridge#lazy-controllers +*/ +/* stimulusFetch: 'lazy' */ +export default class extends Controller { + static targets = ['list', 'message'] + static values = { + collectionUrl: String, + } + // ... + connect() { + this.messageTarget.innerHTML = 'fetching ' + this.collectionUrlValue; + this.loadList(); + } + + + async loadList() { + try { + // this endpoint will return CORS error + const response = await fetch(this.collectionUrlValue); + if (!response.ok) { + throw new Error("Network response was not OK"); + this.errorTarget.innerHTML = 'unable to fetch items at this time.'; + console.error('Failed'); + return; + } else { + // promise resolved. + const items = await response.json(); + const count = items['hydra:totalItems']; + this.messageTarget.innerHTML = `${count} total items`; + + this.listTarget.innerHTML = '
    ' + for (const item of items['hydra:member']) { + // this.listTarget.innerHTML += `
  1. ${item.name}
  2. `; + console.log(item); + } + this.listTarget.innerHTML += `
`; + + console.log(items); + + } + } catch { + this.messageTarget.innerHTML = 'unable to fetch items at this time.'; + console.error('Failed'); + return; + } + } + + refresh() { + this.loadList(); + } + +} diff --git a/composer.json b/composer.json index 5e4e79c..188e4b6 100644 --- a/composer.json +++ b/composer.json @@ -10,16 +10,19 @@ "ext-ctype": "*", "ext-iconv": "*", "ext-imagick": "*", + "api-platform/core": "^3.2", "doctrine/dbal": "^3", "doctrine/doctrine-bundle": "^2.11", "doctrine/doctrine-migrations-bundle": "^3.3", "doctrine/orm": "^3.0", "knplabs/knp-time-bundle": "^2.2", + "nelmio/cors-bundle": "^2.4", "phpdocumentor/reflection-docblock": "^5.3", "phpstan/phpdoc-parser": "^1.25", "spomky-labs/phpwa": "^1.0", + "survos/deployment-bundle": "^1.5", "symfony/asset": "7.0.*", - "symfony/asset-mapper": "7.0.*", + "symfony/asset-mapper": "7.0.3", "symfony/clock": "7.0.*", "symfony/console": "7.0.*", "symfony/dotenv": "7.0.*", @@ -35,6 +38,7 @@ "symfony/property-access": "7.0.*", "symfony/property-info": "7.0.*", "symfony/runtime": "7.0.*", + "symfony/security-bundle": "7.0.*", "symfony/serializer": "7.0.*", "symfony/stimulus-bundle": "^2.13", "symfony/string": "7.0.*", diff --git a/composer.lock b/composer.lock index d295002..a1dba0f 100644 --- a/composer.lock +++ b/composer.lock @@ -4,8 +4,174 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "4021da28cf724cc03002d9748d1988ab", + "content-hash": "0dd628a28241d0cd8d6a17111898c64f", "packages": [ + { + "name": "api-platform/core", + "version": "v3.2.15", + "source": { + "type": "git", + "url": "https://github.com/api-platform/core.git", + "reference": "42215cf81e477cbf8ff872cf3c00822c9a1b79f8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/api-platform/core/zipball/42215cf81e477cbf8ff872cf3c00822c9a1b79f8", + "reference": "42215cf81e477cbf8ff872cf3c00822c9a1b79f8", + "shasum": "" + }, + "require": { + "doctrine/inflector": "^1.0 || ^2.0", + "php": ">=8.1", + "psr/cache": "^1.0 || ^2.0 || ^3.0", + "psr/container": "^1.0 || ^2.0", + "symfony/deprecation-contracts": "^3.1", + "symfony/http-foundation": "^6.1 || ^7.0", + "symfony/http-kernel": "^6.1 || ^7.0", + "symfony/property-access": "^6.1 || ^7.0", + "symfony/property-info": "^6.1 || ^7.0", + "symfony/serializer": "^6.1 || ^7.0", + "symfony/translation-contracts": "^3.3", + "symfony/web-link": "^6.1 || ^7.0", + "willdurand/negotiation": "^3.0" + }, + "conflict": { + "doctrine/common": "<3.2.2", + "doctrine/dbal": "<2.10", + "doctrine/mongodb-odm": "<2.4", + "doctrine/orm": "<2.14.0", + "doctrine/persistence": "<1.3", + "elasticsearch/elasticsearch": ">=8.0,<8.4", + "phpspec/prophecy": "<1.15", + "phpunit/phpunit": "<9.5", + "symfony/var-exporter": "<6.1.1" + }, + "require-dev": { + "behat/behat": "^3.11", + "behat/mink": "^1.9", + "doctrine/cache": "^1.11 || ^2.1", + "doctrine/common": "^3.2.2", + "doctrine/dbal": "^3.4.0", + "doctrine/doctrine-bundle": "^1.12 || ^2.0", + "doctrine/mongodb-odm": "^2.2", + "doctrine/mongodb-odm-bundle": "^4.0 || ^5.0", + "doctrine/orm": "^2.14", + "elasticsearch/elasticsearch": "^7.11 || ^8.4", + "friends-of-behat/mink-browserkit-driver": "^1.3.1", + "friends-of-behat/mink-extension": "^2.2", + "friends-of-behat/symfony-extension": "^2.1", + "guzzlehttp/guzzle": "^6.0 || ^7.0", + "jangregor/phpstan-prophecy": "^1.0", + "justinrainbow/json-schema": "^5.2.1", + "phpspec/prophecy-phpunit": "^2.0", + "phpstan/extension-installer": "^1.1", + "phpstan/phpdoc-parser": "^1.13", + "phpstan/phpstan": "^1.1", + "phpstan/phpstan-doctrine": "^1.0", + "phpstan/phpstan-phpunit": "^1.0", + "phpstan/phpstan-symfony": "^1.0", + "phpunit/phpunit": "^9.5", + "psr/log": "^1.0 || ^2.0 || ^3.0", + "ramsey/uuid": "^3.9.7 || ^4.0", + "ramsey/uuid-doctrine": "^1.4 || ^2.0", + "sebastian/comparator": "<5.0", + "soyuka/contexts": "v3.3.9", + "soyuka/stubs-mongodb": "^1.0", + "symfony/asset": "^6.1 || ^7.0", + "symfony/browser-kit": "^6.1 || ^7.0", + "symfony/cache": "^6.1 || ^7.0", + "symfony/config": "^6.1 || ^7.0", + "symfony/console": "^6.1 || ^7.0", + "symfony/css-selector": "^6.1 || ^7.0", + "symfony/dependency-injection": "^6.1 || ^7.0.12", + "symfony/doctrine-bridge": "^6.1 || ^7.0", + "symfony/dom-crawler": "^6.1 || ^7.0", + "symfony/error-handler": "^6.1 || ^7.0", + "symfony/event-dispatcher": "^6.1 || ^7.0", + "symfony/expression-language": "^6.1 || ^7.0", + "symfony/finder": "^6.1 || ^7.0", + "symfony/form": "^6.1 || ^7.0", + "symfony/framework-bundle": "^6.1 || ^7.0", + "symfony/http-client": "^6.1 || ^7.0", + "symfony/intl": "^6.1 || ^7.0", + "symfony/maker-bundle": "^1.24", + "symfony/mercure-bundle": "*", + "symfony/messenger": "^6.1 || ^7.0", + "symfony/phpunit-bridge": "^6.1 || ^7.0", + "symfony/routing": "^6.1 || ^7.0", + "symfony/security-bundle": "^6.1 || ^7.0", + "symfony/security-core": "^6.1 || ^7.0", + "symfony/stopwatch": "^6.1 || ^7.0", + "symfony/twig-bundle": "^6.1 || ^7.0", + "symfony/uid": "^6.1 || ^7.0", + "symfony/validator": "^6.1 || ^7.0", + "symfony/web-profiler-bundle": "^6.1 || ^7.0", + "symfony/yaml": "^6.1 || ^7.0", + "twig/twig": "^1.42.3 || ^2.12 || ^3.0", + "webonyx/graphql-php": "^14.0 || ^15.0" + }, + "suggest": { + "doctrine/mongodb-odm-bundle": "To support MongoDB. Only versions 4.0 and later are supported.", + "elasticsearch/elasticsearch": "To support Elasticsearch.", + "ocramius/package-versions": "To display the API Platform's version in the debug bar.", + "phpstan/phpdoc-parser": "To support extracting metadata from PHPDoc.", + "psr/cache-implementation": "To use metadata caching.", + "ramsey/uuid": "To support Ramsey's UUID identifiers.", + "symfony/cache": "To have metadata caching when using Symfony integration.", + "symfony/config": "To load XML configuration files.", + "symfony/expression-language": "To use authorization features.", + "symfony/http-client": "To use the HTTP cache invalidation system.", + "symfony/messenger": "To support messenger integration.", + "symfony/security": "To use authorization features.", + "symfony/twig-bundle": "To use the Swagger UI integration.", + "symfony/uid": "To support Symfony UUID/ULID identifiers.", + "symfony/web-profiler-bundle": "To use the data collector.", + "webonyx/graphql-php": "To support GraphQL." + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "3.3.x-dev" + }, + "symfony": { + "require": "^6.1 || ^7.0" + } + }, + "autoload": { + "psr-4": { + "ApiPlatform\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Kévin Dunglas", + "email": "kevin@dunglas.fr", + "homepage": "https://dunglas.fr" + } + ], + "description": "Build a fully-featured hypermedia or GraphQL API in minutes!", + "homepage": "https://api-platform.com", + "keywords": [ + "Hydra", + "JSON-LD", + "api", + "graphql", + "hal", + "jsonapi", + "openapi", + "rest", + "swagger" + ], + "support": { + "issues": "https://github.com/api-platform/core/issues", + "source": "https://github.com/api-platform/core/tree/v3.2.15" + }, + "time": "2024-02-29T14:55:13+00:00" + }, { "name": "composer/semver", "version": "3.4.0", @@ -1157,16 +1323,16 @@ }, { "name": "doctrine/persistence", - "version": "3.2.0", + "version": "3.3.0", "source": { "type": "git", "url": "https://github.com/doctrine/persistence.git", - "reference": "63fee8c33bef740db6730eb2a750cd3da6495603" + "reference": "f75d11b1bcd0a9b75a9e1cabd80ffe3bc0164bcc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/persistence/zipball/63fee8c33bef740db6730eb2a750cd3da6495603", - "reference": "63fee8c33bef740db6730eb2a750cd3da6495603", + "url": "https://api.github.com/repos/doctrine/persistence/zipball/f75d11b1bcd0a9b75a9e1cabd80ffe3bc0164bcc", + "reference": "f75d11b1bcd0a9b75a9e1cabd80ffe3bc0164bcc", "shasum": "" }, "require": { @@ -1235,7 +1401,7 @@ ], "support": { "issues": "https://github.com/doctrine/persistence/issues", - "source": "https://github.com/doctrine/persistence/tree/3.2.0" + "source": "https://github.com/doctrine/persistence/tree/3.3.0" }, "funding": [ { @@ -1251,7 +1417,7 @@ "type": "tidelift" } ], - "time": "2023-05-17T18:32:04+00:00" + "time": "2024-03-01T10:11:31+00:00" }, { "name": "doctrine/sql-formatter", @@ -1481,6 +1647,68 @@ ], "time": "2023-10-27T15:32:31+00:00" }, + { + "name": "nelmio/cors-bundle", + "version": "2.4.0", + "source": { + "type": "git", + "url": "https://github.com/nelmio/NelmioCorsBundle.git", + "reference": "78fcdb91f76b080a1008133def9c7f613833933d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/nelmio/NelmioCorsBundle/zipball/78fcdb91f76b080a1008133def9c7f613833933d", + "reference": "78fcdb91f76b080a1008133def9c7f613833933d", + "shasum": "" + }, + "require": { + "psr/log": "^1.0 || ^2.0 || ^3.0", + "symfony/framework-bundle": "^5.4 || ^6.0 || ^7.0" + }, + "require-dev": { + "mockery/mockery": "^1.3.6", + "symfony/phpunit-bridge": "^5.4 || ^6.0 || ^7.0" + }, + "type": "symfony-bundle", + "extra": { + "branch-alias": { + "dev-master": "2.x-dev" + } + }, + "autoload": { + "psr-4": { + "Nelmio\\CorsBundle\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nelmio", + "homepage": "http://nelm.io" + }, + { + "name": "Symfony Community", + "homepage": "https://github.com/nelmio/NelmioCorsBundle/contributors" + } + ], + "description": "Adds CORS (Cross-Origin Resource Sharing) headers support in your Symfony application", + "keywords": [ + "api", + "cors", + "crossdomain" + ], + "support": { + "issues": "https://github.com/nelmio/NelmioCorsBundle/issues", + "source": "https://github.com/nelmio/NelmioCorsBundle/tree/2.4.0" + }, + "time": "2023-11-30T16:41:19+00:00" + }, { "name": "phpdocumentor/reflection-common", "version": "2.2.0", @@ -2103,6 +2331,64 @@ ], "time": "2024-02-10T12:28:04+00:00" }, + { + "name": "survos/deployment-bundle", + "version": "1.5.163", + "source": { + "type": "git", + "url": "https://github.com/survos/SurvosDeploymentBundle.git", + "reference": "2ef28720da55e083f9d0f956b5a7c713c5228fc0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/survos/SurvosDeploymentBundle/zipball/2ef28720da55e083f9d0f956b5a7c713c5228fc0", + "reference": "2ef28720da55e083f9d0f956b5a7c713c5228fc0", + "shasum": "" + }, + "require": { + "php": "^8.1", + "symfony/config": "^6.3 || ^7.0", + "symfony/console": "^6.3 || ^7.0", + "symfony/dependency-injection": "^6.3 || ^7.0", + "symfony/form": "^6.3 || ^7.0", + "symfony/http-kernel": "^6.3 || ^7.0", + "twig/twig": "^3.4", + "zenstruck/console-extra": "^1.3" + }, + "require-dev": { + "phpstan/phpstan": "^1.7", + "symfony/browser-kit": "^6.3 || ^7.0", + "symfony/framework-bundle": "^6.3 || ^7.0", + "symfony/phpunit-bridge": "^6.3 || ^7.0", + "symfony/twig-bundle": "^6.3 || ^7.0", + "symfony/var-dumper": "^6.3 || ^7.0" + }, + "type": "symfony-bundle", + "autoload": { + "psr-4": { + "Survos\\DeploymentBundle\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "keywords": [ + "symfony-ux", + "symfony6" + ], + "support": { + "issues": "https://github.com/survos/SurvosDeploymentBundle/issues", + "source": "https://github.com/survos/SurvosDeploymentBundle/tree/1.5.163" + }, + "funding": [ + { + "url": "https://github.com/kbond", + "type": "github" + } + ], + "time": "2024-01-21T16:30:48+00:00" + }, { "name": "symfony/asset", "version": "v7.0.3", @@ -2174,16 +2460,16 @@ }, { "name": "symfony/asset-mapper", - "version": "v7.0.4", + "version": "v7.0.3", "source": { "type": "git", "url": "https://github.com/symfony/asset-mapper.git", - "reference": "7cd421551f53849f641a1a3499392ed5c81598a8" + "reference": "537b9575df2f0a809abe9dd1117bb4ec578f7a21" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/asset-mapper/zipball/7cd421551f53849f641a1a3499392ed5c81598a8", - "reference": "7cd421551f53849f641a1a3499392ed5c81598a8", + "url": "https://api.github.com/repos/symfony/asset-mapper/zipball/537b9575df2f0a809abe9dd1117bb4ec578f7a21", + "reference": "537b9575df2f0a809abe9dd1117bb4ec578f7a21", "shasum": "" }, "require": { @@ -2232,7 +2518,7 @@ "description": "Maps directories of assets & makes them available in a public directory with versioned filenames.", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/asset-mapper/tree/v7.0.4" + "source": "https://github.com/symfony/asset-mapper/tree/v7.0.3" }, "funding": [ { @@ -2248,7 +2534,7 @@ "type": "tidelift" } ], - "time": "2024-02-22T20:27:20+00:00" + "time": "2024-01-23T19:26:06+00:00" }, { "name": "symfony/cache", @@ -4469,6 +4755,78 @@ ], "time": "2023-08-08T10:20:21+00:00" }, + { + "name": "symfony/password-hasher", + "version": "v7.0.4", + "source": { + "type": "git", + "url": "https://github.com/symfony/password-hasher.git", + "reference": "0eba656c16ecdf5588b3ddd2b2337b06173d839f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/password-hasher/zipball/0eba656c16ecdf5588b3ddd2b2337b06173d839f", + "reference": "0eba656c16ecdf5588b3ddd2b2337b06173d839f", + "shasum": "" + }, + "require": { + "php": ">=8.2" + }, + "conflict": { + "symfony/security-core": "<6.4" + }, + "require-dev": { + "symfony/console": "^6.4|^7.0", + "symfony/security-core": "^6.4|^7.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Symfony\\Component\\PasswordHasher\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Robin Chalas", + "email": "robin.chalas@gmail.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Provides password hashing utilities", + "homepage": "https://symfony.com", + "keywords": [ + "hashing", + "password" + ], + "support": { + "source": "https://github.com/symfony/password-hasher/tree/v7.0.4" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2024-02-12T11:15:03+00:00" + }, { "name": "symfony/polyfill-intl-grapheme", "version": "v1.29.0", @@ -5413,60 +5771,76 @@ "time": "2024-01-23T15:02:46+00:00" }, { - "name": "symfony/serializer", + "name": "symfony/security-bundle", "version": "v7.0.4", "source": { "type": "git", - "url": "https://github.com/symfony/serializer.git", - "reference": "c71d61c6c37804e10981960e5f5ebc2c8f0a4fbb" + "url": "https://github.com/symfony/security-bundle.git", + "reference": "1755fb50e4da0a0013569752be763d208d690bcd" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/serializer/zipball/c71d61c6c37804e10981960e5f5ebc2c8f0a4fbb", - "reference": "c71d61c6c37804e10981960e5f5ebc2c8f0a4fbb", + "url": "https://api.github.com/repos/symfony/security-bundle/zipball/1755fb50e4da0a0013569752be763d208d690bcd", + "reference": "1755fb50e4da0a0013569752be763d208d690bcd", "shasum": "" }, "require": { + "composer-runtime-api": ">=2.1", + "ext-xml": "*", "php": ">=8.2", - "symfony/polyfill-ctype": "~1.8" + "symfony/clock": "^6.4|^7.0", + "symfony/config": "^6.4|^7.0", + "symfony/dependency-injection": "^6.4|^7.0", + "symfony/event-dispatcher": "^6.4|^7.0", + "symfony/http-foundation": "^6.4|^7.0", + "symfony/http-kernel": "^6.4|^7.0", + "symfony/password-hasher": "^6.4|^7.0", + "symfony/security-core": "^6.4|^7.0", + "symfony/security-csrf": "^6.4|^7.0", + "symfony/security-http": "^6.4|^7.0", + "symfony/service-contracts": "^2.5|^3" }, "conflict": { - "phpdocumentor/reflection-docblock": "<3.2.2", - "phpdocumentor/type-resolver": "<1.4.0", - "symfony/dependency-injection": "<6.4", - "symfony/property-access": "<6.4", - "symfony/property-info": "<6.4", - "symfony/uid": "<6.4", - "symfony/validator": "<6.4", - "symfony/yaml": "<6.4" + "symfony/browser-kit": "<6.4", + "symfony/console": "<6.4", + "symfony/framework-bundle": "<6.4", + "symfony/http-client": "<6.4", + "symfony/ldap": "<6.4", + "symfony/serializer": "<6.4", + "symfony/twig-bundle": "<6.4", + "symfony/validator": "<6.4" }, "require-dev": { - "phpdocumentor/reflection-docblock": "^3.2|^4.0|^5.0", - "seld/jsonlint": "^1.10", - "symfony/cache": "^6.4|^7.0", - "symfony/config": "^6.4|^7.0", + "symfony/asset": "^6.4|^7.0", + "symfony/browser-kit": "^6.4|^7.0", "symfony/console": "^6.4|^7.0", - "symfony/dependency-injection": "^6.4|^7.0", - "symfony/error-handler": "^6.4|^7.0", - "symfony/filesystem": "^6.4|^7.0", + "symfony/css-selector": "^6.4|^7.0", + "symfony/dom-crawler": "^6.4|^7.0", + "symfony/expression-language": "^6.4|^7.0", "symfony/form": "^6.4|^7.0", - "symfony/http-foundation": "^6.4|^7.0", - "symfony/http-kernel": "^6.4|^7.0", - "symfony/messenger": "^6.4|^7.0", - "symfony/mime": "^6.4|^7.0", - "symfony/property-access": "^6.4|^7.0", - "symfony/property-info": "^6.4|^7.0", - "symfony/translation-contracts": "^2.5|^3", - "symfony/uid": "^6.4|^7.0", + "symfony/framework-bundle": "^6.4|^7.0", + "symfony/http-client": "^6.4|^7.0", + "symfony/ldap": "^6.4|^7.0", + "symfony/process": "^6.4|^7.0", + "symfony/rate-limiter": "^6.4|^7.0", + "symfony/serializer": "^6.4|^7.0", + "symfony/translation": "^6.4|^7.0", + "symfony/twig-bridge": "^6.4|^7.0", + "symfony/twig-bundle": "^6.4|^7.0", "symfony/validator": "^6.4|^7.0", - "symfony/var-dumper": "^6.4|^7.0", - "symfony/var-exporter": "^6.4|^7.0", - "symfony/yaml": "^6.4|^7.0" + "symfony/yaml": "^6.4|^7.0", + "twig/twig": "^3.0.4", + "web-token/jwt-checker": "^3.1", + "web-token/jwt-signature-algorithm-ecdsa": "^3.1", + "web-token/jwt-signature-algorithm-eddsa": "^3.1", + "web-token/jwt-signature-algorithm-hmac": "^3.1", + "web-token/jwt-signature-algorithm-none": "^3.1", + "web-token/jwt-signature-algorithm-rsa": "^3.1" }, - "type": "library", + "type": "symfony-bundle", "autoload": { "psr-4": { - "Symfony\\Component\\Serializer\\": "" + "Symfony\\Bundle\\SecurityBundle\\": "" }, "exclude-from-classmap": [ "/Tests/" @@ -5486,10 +5860,344 @@ "homepage": "https://symfony.com/contributors" } ], - "description": "Handles serializing and deserializing data structures, including object graphs, into array structures or other formats like XML and JSON.", + "description": "Provides a tight integration of the Security component into the Symfony full-stack framework", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/serializer/tree/v7.0.4" + "source": "https://github.com/symfony/security-bundle/tree/v7.0.4" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2024-02-15T11:33:06+00:00" + }, + { + "name": "symfony/security-core", + "version": "v7.0.3", + "source": { + "type": "git", + "url": "https://github.com/symfony/security-core.git", + "reference": "72b9d961a5dcd21e6bc29b99df51a9000a15dde0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/security-core/zipball/72b9d961a5dcd21e6bc29b99df51a9000a15dde0", + "reference": "72b9d961a5dcd21e6bc29b99df51a9000a15dde0", + "shasum": "" + }, + "require": { + "php": ">=8.2", + "symfony/event-dispatcher-contracts": "^2.5|^3", + "symfony/password-hasher": "^6.4|^7.0", + "symfony/service-contracts": "^2.5|^3" + }, + "conflict": { + "symfony/event-dispatcher": "<6.4", + "symfony/http-foundation": "<6.4", + "symfony/ldap": "<6.4", + "symfony/translation": "<6.4.3|>=7.0,<7.0.3", + "symfony/validator": "<6.4" + }, + "require-dev": { + "psr/cache": "^1.0|^2.0|^3.0", + "psr/container": "^1.1|^2.0", + "psr/log": "^1|^2|^3", + "symfony/cache": "^6.4|^7.0", + "symfony/event-dispatcher": "^6.4|^7.0", + "symfony/expression-language": "^6.4|^7.0", + "symfony/http-foundation": "^6.4|^7.0", + "symfony/ldap": "^6.4|^7.0", + "symfony/string": "^6.4|^7.0", + "symfony/translation": "^6.4.3|^7.0.3", + "symfony/validator": "^6.4|^7.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Symfony\\Component\\Security\\Core\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Security Component - Core Library", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/security-core/tree/v7.0.3" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2024-01-23T15:02:46+00:00" + }, + { + "name": "symfony/security-csrf", + "version": "v7.0.3", + "source": { + "type": "git", + "url": "https://github.com/symfony/security-csrf.git", + "reference": "f0f724e599f069b768e335e4bdf795726c7dfe8e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/security-csrf/zipball/f0f724e599f069b768e335e4bdf795726c7dfe8e", + "reference": "f0f724e599f069b768e335e4bdf795726c7dfe8e", + "shasum": "" + }, + "require": { + "php": ">=8.2", + "symfony/security-core": "^6.4|^7.0" + }, + "conflict": { + "symfony/http-foundation": "<6.4" + }, + "require-dev": { + "symfony/http-foundation": "^6.4|^7.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Symfony\\Component\\Security\\Csrf\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Security Component - CSRF Library", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/security-csrf/tree/v7.0.3" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2024-01-23T15:02:46+00:00" + }, + { + "name": "symfony/security-http", + "version": "v7.0.4", + "source": { + "type": "git", + "url": "https://github.com/symfony/security-http.git", + "reference": "f3a70a937128f47366821a9f4b5dbfaa0ba9c862" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/security-http/zipball/f3a70a937128f47366821a9f4b5dbfaa0ba9c862", + "reference": "f3a70a937128f47366821a9f4b5dbfaa0ba9c862", + "shasum": "" + }, + "require": { + "php": ">=8.2", + "symfony/http-foundation": "^6.4|^7.0", + "symfony/http-kernel": "^6.4|^7.0", + "symfony/polyfill-mbstring": "~1.0", + "symfony/property-access": "^6.4|^7.0", + "symfony/security-core": "^6.4|^7.0", + "symfony/service-contracts": "^2.5|^3" + }, + "conflict": { + "symfony/clock": "<6.4", + "symfony/event-dispatcher": "<6.4", + "symfony/http-client-contracts": "<3.0", + "symfony/security-bundle": "<6.4", + "symfony/security-csrf": "<6.4" + }, + "require-dev": { + "psr/log": "^1|^2|^3", + "symfony/cache": "^6.4|^7.0", + "symfony/clock": "^6.4|^7.0", + "symfony/expression-language": "^6.4|^7.0", + "symfony/http-client-contracts": "^3.0", + "symfony/rate-limiter": "^6.4|^7.0", + "symfony/routing": "^6.4|^7.0", + "symfony/security-csrf": "^6.4|^7.0", + "symfony/translation": "^6.4|^7.0", + "web-token/jwt-checker": "^3.1", + "web-token/jwt-signature-algorithm-ecdsa": "^3.1" + }, + "type": "library", + "autoload": { + "psr-4": { + "Symfony\\Component\\Security\\Http\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Security Component - HTTP Integration", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/security-http/tree/v7.0.4" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2024-02-26T07:52:39+00:00" + }, + { + "name": "symfony/serializer", + "version": "v7.0.4", + "source": { + "type": "git", + "url": "https://github.com/symfony/serializer.git", + "reference": "c71d61c6c37804e10981960e5f5ebc2c8f0a4fbb" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/serializer/zipball/c71d61c6c37804e10981960e5f5ebc2c8f0a4fbb", + "reference": "c71d61c6c37804e10981960e5f5ebc2c8f0a4fbb", + "shasum": "" + }, + "require": { + "php": ">=8.2", + "symfony/polyfill-ctype": "~1.8" + }, + "conflict": { + "phpdocumentor/reflection-docblock": "<3.2.2", + "phpdocumentor/type-resolver": "<1.4.0", + "symfony/dependency-injection": "<6.4", + "symfony/property-access": "<6.4", + "symfony/property-info": "<6.4", + "symfony/uid": "<6.4", + "symfony/validator": "<6.4", + "symfony/yaml": "<6.4" + }, + "require-dev": { + "phpdocumentor/reflection-docblock": "^3.2|^4.0|^5.0", + "seld/jsonlint": "^1.10", + "symfony/cache": "^6.4|^7.0", + "symfony/config": "^6.4|^7.0", + "symfony/console": "^6.4|^7.0", + "symfony/dependency-injection": "^6.4|^7.0", + "symfony/error-handler": "^6.4|^7.0", + "symfony/filesystem": "^6.4|^7.0", + "symfony/form": "^6.4|^7.0", + "symfony/http-foundation": "^6.4|^7.0", + "symfony/http-kernel": "^6.4|^7.0", + "symfony/messenger": "^6.4|^7.0", + "symfony/mime": "^6.4|^7.0", + "symfony/property-access": "^6.4|^7.0", + "symfony/property-info": "^6.4|^7.0", + "symfony/translation-contracts": "^2.5|^3", + "symfony/uid": "^6.4|^7.0", + "symfony/validator": "^6.4|^7.0", + "symfony/var-dumper": "^6.4|^7.0", + "symfony/var-exporter": "^6.4|^7.0", + "symfony/yaml": "^6.4|^7.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Symfony\\Component\\Serializer\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Handles serializing and deserializing data structures, including object graphs, into array structures or other formats like XML and JSON.", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/serializer/tree/v7.0.4" }, "funding": [ { @@ -5591,16 +6299,16 @@ }, { "name": "symfony/stimulus-bundle", - "version": "v2.15.0", + "version": "v2.16.0", "source": { "type": "git", "url": "https://github.com/symfony/stimulus-bundle.git", - "reference": "c113ab8e92c6b14659f6be4e9bef5c1f4c4a000e" + "reference": "6add4bdab1b9df4f2b2532a9dcb7b2f26dbba634" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/stimulus-bundle/zipball/c113ab8e92c6b14659f6be4e9bef5c1f4c4a000e", - "reference": "c113ab8e92c6b14659f6be4e9bef5c1f4c4a000e", + "url": "https://api.github.com/repos/symfony/stimulus-bundle/zipball/6add4bdab1b9df4f2b2532a9dcb7b2f26dbba634", + "reference": "6add4bdab1b9df4f2b2532a9dcb7b2f26dbba634", "shasum": "" }, "require": { @@ -5640,7 +6348,7 @@ "symfony-ux" ], "support": { - "source": "https://github.com/symfony/stimulus-bundle/tree/v2.15.0" + "source": "https://github.com/symfony/stimulus-bundle/tree/v2.16.0" }, "funding": [ { @@ -5656,7 +6364,7 @@ "type": "tidelift" } ], - "time": "2024-02-14T16:26:57+00:00" + "time": "2024-02-29T16:20:46+00:00" }, { "name": "symfony/stopwatch", @@ -6906,6 +7614,186 @@ "source": "https://github.com/webmozarts/assert/tree/1.11.0" }, "time": "2022-06-03T18:03:27+00:00" + }, + { + "name": "willdurand/negotiation", + "version": "3.1.0", + "source": { + "type": "git", + "url": "https://github.com/willdurand/Negotiation.git", + "reference": "68e9ea0553ef6e2ee8db5c1d98829f111e623ec2" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/willdurand/Negotiation/zipball/68e9ea0553ef6e2ee8db5c1d98829f111e623ec2", + "reference": "68e9ea0553ef6e2ee8db5c1d98829f111e623ec2", + "shasum": "" + }, + "require": { + "php": ">=7.1.0" + }, + "require-dev": { + "symfony/phpunit-bridge": "^5.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0-dev" + } + }, + "autoload": { + "psr-4": { + "Negotiation\\": "src/Negotiation" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "William Durand", + "email": "will+git@drnd.me" + } + ], + "description": "Content Negotiation tools for PHP provided as a standalone library.", + "homepage": "http://williamdurand.fr/Negotiation/", + "keywords": [ + "accept", + "content", + "format", + "header", + "negotiation" + ], + "support": { + "issues": "https://github.com/willdurand/Negotiation/issues", + "source": "https://github.com/willdurand/Negotiation/tree/3.1.0" + }, + "time": "2022-01-30T20:08:53+00:00" + }, + { + "name": "zenstruck/callback", + "version": "v1.5.0", + "source": { + "type": "git", + "url": "https://github.com/zenstruck/callback.git", + "reference": "eed9a532fd8974368e60c4a2550ed65eab7e5432" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/zenstruck/callback/zipball/eed9a532fd8974368e60c4a2550ed65eab7e5432", + "reference": "eed9a532fd8974368e60c4a2550ed65eab7e5432", + "shasum": "" + }, + "require": { + "php": ">=7.2.5", + "symfony/polyfill-php80": "^1.14" + }, + "require-dev": { + "symfony/phpunit-bridge": "^5.2" + }, + "type": "library", + "autoload": { + "psr-4": { + "Zenstruck\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Kevin Bond", + "email": "kevinbond@gmail.com" + } + ], + "description": "Callable wrapper to validate and inject arguments.", + "homepage": "https://github.com/zenstruck/callback", + "keywords": [ + "callable", + "callback", + "utility" + ], + "support": { + "issues": "https://github.com/zenstruck/callback/issues", + "source": "https://github.com/zenstruck/callback/tree/v1.5.0" + }, + "funding": [ + { + "url": "https://github.com/kbond", + "type": "github" + } + ], + "time": "2022-08-31T14:56:15+00:00" + }, + { + "name": "zenstruck/console-extra", + "version": "v1.4.0", + "source": { + "type": "git", + "url": "https://github.com/zenstruck/console-extra.git", + "reference": "f503281cf4eb33a9b224ac4f032f585b6c307fb4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/zenstruck/console-extra/zipball/f503281cf4eb33a9b224ac4f032f585b6c307fb4", + "reference": "f503281cf4eb33a9b224ac4f032f585b6c307fb4", + "shasum": "" + }, + "require": { + "php": ">=8.1", + "symfony/console": "^6.4|^7.0", + "symfony/deprecation-contracts": "^2.2|^3.0", + "zenstruck/callback": "^1.4.2" + }, + "conflict": { + "symfony/service-contracts": "<3.2" + }, + "require-dev": { + "phpdocumentor/reflection-docblock": "^5.2", + "phpstan/phpstan": "^1.4", + "phpunit/phpunit": "^9.5", + "symfony/framework-bundle": "^6.4|^7.0", + "symfony/phpunit-bridge": "^6.2|^7.0", + "symfony/process": "^6.4|^7.0", + "symfony/var-dumper": "^6.4|^7.0", + "zenstruck/console-test": "^1.4" + }, + "type": "library", + "autoload": { + "psr-4": { + "Zenstruck\\Console\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Kevin Bond", + "email": "kevinbond@gmail.com" + } + ], + "description": "A modular set of features to reduce configuration boilerplate for your Symfony commands.", + "homepage": "https://github.com/zenstruck/console-extra", + "keywords": [ + "command", + "console", + "symfony" + ], + "support": { + "issues": "https://github.com/zenstruck/console-extra/issues", + "source": "https://github.com/zenstruck/console-extra/tree/v1.4.0" + }, + "funding": [ + { + "url": "https://github.com/kbond", + "type": "github" + } + ], + "time": "2024-02-19T13:23:41+00:00" } ], "packages-dev": [ diff --git a/config/bundles.php b/config/bundles.php index 359a048..4ecfcca 100644 --- a/config/bundles.php +++ b/config/bundles.php @@ -14,4 +14,8 @@ Doctrine\Bundle\DoctrineBundle\DoctrineBundle::class => ['all' => true], Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle::class => ['all' => true], Knp\Bundle\TimeBundle\KnpTimeBundle::class => ['all' => true], + Survos\DeploymentBundle\SurvosDeploymentBundle::class => ['all' => true], + Symfony\Bundle\SecurityBundle\SecurityBundle::class => ['all' => true], + Nelmio\CorsBundle\NelmioCorsBundle::class => ['all' => true], + ApiPlatform\Symfony\Bundle\ApiPlatformBundle::class => ['all' => true], ]; diff --git a/config/packages/api_platform.yaml b/config/packages/api_platform.yaml new file mode 100644 index 0000000..4d0c3f7 --- /dev/null +++ b/config/packages/api_platform.yaml @@ -0,0 +1,18 @@ +api_platform: + title: Hello API Platform + version: 1.0.0 + formats: + jsonld: ['application/ld+json'] + docs_formats: + jsonld: ['application/ld+json'] + jsonopenapi: ['application/vnd.openapi+json'] + html: ['text/html'] + defaults: + stateless: true + cache_headers: + vary: ['Content-Type', 'Authorization', 'Origin'] + extra_properties: + standard_put: true + rfc_7807_compliant_errors: true + event_listeners_backward_compatibility_layer: false + keep_legacy_inflector: false diff --git a/config/packages/nelmio_cors.yaml b/config/packages/nelmio_cors.yaml new file mode 100644 index 0000000..c766508 --- /dev/null +++ b/config/packages/nelmio_cors.yaml @@ -0,0 +1,10 @@ +nelmio_cors: + defaults: + origin_regex: true + allow_origin: ['%env(CORS_ALLOW_ORIGIN)%'] + allow_methods: ['GET', 'OPTIONS', 'POST', 'PUT', 'PATCH', 'DELETE'] + allow_headers: ['Content-Type', 'Authorization'] + expose_headers: ['Link'] + max_age: 3600 + paths: + '^/': null diff --git a/config/packages/pwa.yaml b/config/packages/pwa.yaml index 6fd8d6d..1653442 100644 --- a/config/packages/pwa.yaml +++ b/config/packages/pwa.yaml @@ -31,4 +31,5 @@ pwa: workbox: warm_cache_urls: - 'app_homepage' + - '_api_/items{._format}_get_collection' page_fallback: 'app_homepage' diff --git a/config/packages/security.yaml b/config/packages/security.yaml new file mode 100644 index 0000000..367af25 --- /dev/null +++ b/config/packages/security.yaml @@ -0,0 +1,39 @@ +security: + # https://symfony.com/doc/current/security.html#registering-the-user-hashing-passwords + password_hashers: + Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface: 'auto' + # https://symfony.com/doc/current/security.html#loading-the-user-the-user-provider + providers: + users_in_memory: { memory: null } + firewalls: + dev: + pattern: ^/(_(profiler|wdt)|css|images|js)/ + security: false + main: + lazy: true + provider: users_in_memory + + # activate different ways to authenticate + # https://symfony.com/doc/current/security.html#the-firewall + + # https://symfony.com/doc/current/security/impersonating_user.html + # switch_user: true + + # Easy way to control access for large sections of your site + # Note: Only the *first* access control that matches will be used + access_control: + # - { path: ^/admin, roles: ROLE_ADMIN } + # - { path: ^/profile, roles: ROLE_USER } + +when@test: + security: + password_hashers: + # By default, password hashers are resource intensive and take time. This is + # important to generate secure password hashes. In tests however, secure hashes + # are not important, waste resources and increase test times. The following + # reduces the work factor to the lowest possible values. + Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface: + algorithm: auto + cost: 4 # Lowest possible value for bcrypt + time_cost: 3 # Lowest possible value for argon + memory_cost: 10 # Lowest possible value for argon diff --git a/config/routes/api_platform.yaml b/config/routes/api_platform.yaml new file mode 100644 index 0000000..38f11cb --- /dev/null +++ b/config/routes/api_platform.yaml @@ -0,0 +1,4 @@ +api_platform: + resource: . + type: api_platform + prefix: /api diff --git a/config/routes/security.yaml b/config/routes/security.yaml new file mode 100644 index 0000000..f853be1 --- /dev/null +++ b/config/routes/security.yaml @@ -0,0 +1,3 @@ +_security_logout: + resource: security.route_loader.logout + type: service diff --git a/config/secrets/dev/dev.APP_SECRET.1cf811.php b/config/secrets/dev/dev.APP_SECRET.1cf811.php new file mode 100644 index 0000000..5c52dc9 --- /dev/null +++ b/config/secrets/dev/dev.APP_SECRET.1cf811.php @@ -0,0 +1,3 @@ + null, +]; diff --git a/fpm_custom.conf b/fpm_custom.conf new file mode 100644 index 0000000..a97d540 --- /dev/null +++ b/fpm_custom.conf @@ -0,0 +1,3 @@ +php_value[memory_limit] = 256M +php_value[post_max_size] = 100M +php_value[upload_max_filesize] = 100M \ No newline at end of file diff --git a/importmap.php b/importmap.php index 4f6b32e..5815803 100644 --- a/importmap.php +++ b/importmap.php @@ -10,6 +10,8 @@ * be used as an "entrypoint" (and passed to the importmap() Twig function). * * The "importmap:require" command can be used to add new entries to this file. + * + * This file has been auto-generated by the importmap commands. */ return [ 'app' => [ @@ -22,4 +24,40 @@ '@hotwired/stimulus' => [ 'version' => '3.2.2', ], + 'moustache' => [ + 'version' => '0.0.4', + ], + 'stimulus-timeago' => [ + 'version' => '4.1.0', + ], + 'date-fns' => [ + 'version' => '2.30.0', + ], + '@babel/runtime/helpers/esm/typeof' => [ + 'version' => '7.23.8', + ], + '@babel/runtime/helpers/esm/createForOfIteratorHelper' => [ + 'version' => '7.23.8', + ], + '@babel/runtime/helpers/esm/assertThisInitialized' => [ + 'version' => '7.23.8', + ], + '@babel/runtime/helpers/esm/inherits' => [ + 'version' => '7.23.8', + ], + '@babel/runtime/helpers/esm/createSuper' => [ + 'version' => '7.23.8', + ], + '@babel/runtime/helpers/esm/classCallCheck' => [ + 'version' => '7.23.8', + ], + '@babel/runtime/helpers/esm/createClass' => [ + 'version' => '7.23.8', + ], + '@babel/runtime/helpers/esm/defineProperty' => [ + 'version' => '7.23.8', + ], + 'mustache' => [ + 'version' => '4.2.0', + ], ]; diff --git a/nginx.conf b/nginx.conf new file mode 100644 index 0000000..a967465 --- /dev/null +++ b/nginx.conf @@ -0,0 +1,70 @@ +add_header X-Frame-Options "SAMEORIGIN"; +add_header X-XSS-Protection "1; mode=block"; +add_header X-Content-Type-Options "nosniff"; + +index index.php index.html index.htm; + +charset utf-8; + +gzip on; +gzip_comp_level 5; +gzip_min_length 256; +gzip_proxied any; +gzip_vary on; +gzip_types + application/atom+xml + application/javascript + application/json + application/ld+json + application/manifest+json + application/rss+xml + application/vnd.geo+json + application/vnd.ms-fontobject + application/x-font-ttf + application/x-web-app-manifest+json + application/xhtml+xml + application/xml + font/opentype + image/bmp + image/svg+xml + image/x-icon + text/cache-manifest + text/css + text/plain + text/vcard + text/vnd.rim.location.xloc + text/vtt + text/x-component + text/x-cross-domain-policy; + +# +#if ($http_x_forwarded_proto != "https") { +# return 301 https://$host$request_uri; +#} + +# see https://medium.freecodecamp.org/how-you-can-host-multiple-domain-names-and-projects-in-one-vps-7aed4f56e7a1 +location / { + try_files $uri $uri/ /index.php?$query_string; + + fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name; + fastcgi_param DOCUMENT_ROOT $realpath_root; + + if ($request_uri ~* ".(ico|css|js|gif|jpe?g|png)$") { + expires 3d; + access_log off; + add_header Pragma public; + add_header Cache-Control "public"; + break; + } + +} + +location = /icons/favicon.ico { access_log off; log_not_found off; } +location = /robots.txt { access_log off; log_not_found off; } + +error_page 404 /index.php; + + +location ~ /\.(?!well-known).* { + deny all; +} diff --git a/src/ApiResource/.gitignore b/src/ApiResource/.gitignore new file mode 100644 index 0000000..e69de29 diff --git a/src/Controller/HomepageController.php b/src/Controller/HomepageController.php index c918862..6bd5f37 100644 --- a/src/Controller/HomepageController.php +++ b/src/Controller/HomepageController.php @@ -29,7 +29,7 @@ public function homepage(Request $request): Response return $this->render('homepage/index.html.twig', [ 'form' => $form, - 'items' => $this->itemRepository->findAll(), + 'items' => $this->itemRepository->findBy([], ['id' => 'DESC'], 50), ]); } diff --git a/src/Entity/Item.php b/src/Entity/Item.php index 724897f..d008e22 100644 --- a/src/Entity/Item.php +++ b/src/Entity/Item.php @@ -2,12 +2,17 @@ namespace App\Entity; +use ApiPlatform\Doctrine\Orm\Filter\OrderFilter; +use ApiPlatform\Metadata\ApiFilter; +use ApiPlatform\Metadata\ApiResource; use App\Repository\ItemRepository; use Doctrine\DBAL\Types\Types; use Doctrine\ORM\Mapping as ORM; #[ORM\Table(name: 'items')] #[ORM\Entity(repositoryClass: ItemRepository::class)] +#[ApiResource()] +#[ApiFilter(OrderFilter::class, properties: ['id', 'name'], arguments: ['orderParameterName' => 'order'])] class Item { public function __construct( diff --git a/symfony.lock b/symfony.lock index 05b59a5..afc4535 100644 --- a/symfony.lock +++ b/symfony.lock @@ -1,4 +1,18 @@ { + "api-platform/core": { + "version": "3.2", + "recipe": { + "repo": "github.com/symfony/recipes", + "branch": "main", + "version": "3.2", + "ref": "696d44adc3c0d4f5d25a2f1c4f3700dd8a5c6db9" + }, + "files": [ + "config/packages/api_platform.yaml", + "config/routes/api_platform.yaml", + "src/ApiResource/.gitignore" + ] + }, "doctrine/doctrine-bundle": { "version": "2.11", "recipe": { @@ -29,6 +43,18 @@ "knplabs/knp-time-bundle": { "version": "v2.2.0" }, + "nelmio/cors-bundle": { + "version": "2.4", + "recipe": { + "repo": "github.com/symfony/recipes", + "branch": "main", + "version": "1.5", + "ref": "6bea22e6c564fba3a1391615cada1437d0bde39c" + }, + "files": [ + "config/packages/nelmio_cors.yaml" + ] + }, "phpunit/phpunit": { "version": "9.6", "recipe": { @@ -46,6 +72,9 @@ "spomky-labs/phpwa": { "version": "1.0.2" }, + "survos/deployment-bundle": { + "version": "1.5.163" + }, "symfony/asset-mapper": { "version": "7.0", "recipe": { @@ -174,6 +203,19 @@ "config/routes.yaml" ] }, + "symfony/security-bundle": { + "version": "7.0", + "recipe": { + "repo": "github.com/symfony/recipes", + "branch": "main", + "version": "6.4", + "ref": "2ae08430db28c8eb4476605894296c82a642028f" + }, + "files": [ + "config/packages/security.yaml", + "config/routes/security.yaml" + ] + }, "symfony/stimulus-bundle": { "version": "2.15", "recipe": { diff --git a/templates/homepage/index.html.twig b/templates/homepage/index.html.twig index 8f40498..406d2fc 100644 --- a/templates/homepage/index.html.twig +++ b/templates/homepage/index.html.twig @@ -3,6 +3,7 @@ {% block title %}Symfony+PWA=💕{% endblock %} {% block body %} +
+ +
+ Welcome message here... +
+
{{ form_start(form, {attr: {class: ' class="max-w-sm mx-auto"'}}) }} @@ -33,11 +39,37 @@
    + {% set _sc = 'items' %} +
    +
    + ...Loading the todo list... +
    + + + +
    + List here. +
    +
    {% for item in items %}
  • {{ item.name }}
    - {{ item.createdAt|time_diff }} + . + +{# via twig#} +{# {{ item.createdAt|time_diff }}#} +
    {% if item.done %} @@ -54,4 +86,16 @@
+ + {% endblock %}