├── .env
├── .env.test
├── .gitignore
├── README.md
├── bin
├── console
└── phpunit
├── composer.json
├── composer.lock
├── config
├── bundles.php
├── packages
│ ├── api_platform.yaml
│ ├── cache.yaml
│ ├── dev
│ │ ├── debug.yaml
│ │ ├── monolog.yaml
│ │ └── web_profiler.yaml
│ ├── doctrine.yaml
│ ├── doctrine_migrations.yaml
│ ├── framework.yaml
│ ├── messenger.yaml
│ ├── nelmio_cors.yaml
│ ├── prod
│ │ ├── deprecations.yaml
│ │ ├── doctrine.yaml
│ │ └── monolog.yaml
│ ├── routing.yaml
│ ├── security.yaml
│ ├── test
│ │ ├── doctrine.yaml
│ │ ├── monolog.yaml
│ │ ├── validator.yaml
│ │ └── web_profiler.yaml
│ ├── twig.yaml
│ └── validator.yaml
├── preload.php
├── routes.yaml
├── routes
│ ├── annotations.yaml
│ ├── api_platform.yaml
│ ├── dev
│ │ └── web_profiler.yaml
│ └── framework.yaml
└── services.yaml
├── migrations
└── Version20211031095709.php
├── phpunit.xml.dist
├── public
└── index.php
├── src
├── Application
│ └── Panda
│ │ ├── Command
│ │ └── FeedPanda.php
│ │ ├── Exception
│ │ └── PandaNotFoundException.php
│ │ ├── Handler
│ │ └── FeedPandaHandler.php
│ │ └── Query
│ │ └── GetPandaOutput.php
├── Domain
│ └── Panda
│ │ ├── Model
│ │ ├── Bamboo.php
│ │ ├── Panda.php
│ │ └── PandaId.php
│ │ └── PandaRepository.php
└── Infrastructure
│ ├── Kernel.php
│ └── Panda
│ ├── ApiPlatform
│ ├── IdentifierDenormalizer
│ │ └── PandaIdentifierDenormalizer.php
│ └── Transformer
│ │ └── GetPandaOutputTransformer.php
│ └── Repository
│ ├── PandaRepositoryUsingDoctrine.php
│ └── PandaRepositoryUsingMemory.php
├── symfony.lock
├── templates
└── base.html.twig
└── tests
├── Acceptance
└── FeedPandaServiceTest.php
└── bootstrap.php
/.env:
--------------------------------------------------------------------------------
1 | ###> symfony/framework-bundle ###
2 | APP_ENV=dev
3 | APP_SECRET=72627d1e2f8a2799c84ba87c19b7b260
4 | ###< symfony/framework-bundle ###
5 |
6 | ###> doctrine/doctrine-bundle ###
7 | # Format described at https://www.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/configuration.html#connecting-using-a-url
8 | # IMPORTANT: You MUST configure your server version, either here or in config/packages/doctrine.yaml
9 | #
10 | DATABASE_URL="sqlite:///%kernel.project_dir%/var/data.db"
11 | # DATABASE_URL="mysql://db_user:db_password@127.0.0.1:3306/db_name?serverVersion=5.7"
12 | # DATABASE_URL="postgresql://symfony:ChangeMe@127.0.0.1:5432/app?serverVersion=13&charset=utf8"
13 | ###< doctrine/doctrine-bundle ###
14 |
15 | ###> nelmio/cors-bundle ###
16 | CORS_ALLOW_ORIGIN='^https?://(localhost|127\.0\.0\.1)(:[0-9]+)?$'
17 | ###< nelmio/cors-bundle ###
18 |
19 | ###> symfony/messenger ###
20 | # Choose one of the transports below
21 | # MESSENGER_TRANSPORT_DSN=doctrine://default
22 | # MESSENGER_TRANSPORT_DSN=amqp://guest:guest@localhost:5672/%2f/messages
23 | # MESSENGER_TRANSPORT_DSN=redis://localhost:6379/messages
24 | ###< symfony/messenger ###
25 |
--------------------------------------------------------------------------------
/.env.test:
--------------------------------------------------------------------------------
1 | # define your env variables for the test env here
2 | KERNEL_CLASS='App\Kernel'
3 | APP_SECRET='$ecretf0rt3st'
4 | SYMFONY_DEPRECATIONS_HELPER=999999
5 | PANTHER_APP_ENV=panther
6 | PANTHER_ERROR_SCREENSHOT_DIR=./var/error-screenshots
7 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 |
2 | ###> symfony/framework-bundle ###
3 | /.env.local
4 | /.env.local.php
5 | /.env.*.local
6 | /config/secrets/prod/prod.decrypt.private.php
7 | /public/bundles/
8 | /var/
9 | /vendor/
10 | ###< symfony/framework-bundle ###
11 |
12 | ###> symfony/phpunit-bridge ###
13 | .phpunit.result.cache
14 | /phpunit.xml
15 | ###< symfony/phpunit-bridge ###
16 |
17 | ###> phpunit/phpunit ###
18 | /phpunit.xml
19 | .phpunit.result.cache
20 | ###< phpunit/phpunit ###
21 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | apip-ddd
2 |
--------------------------------------------------------------------------------
/bin/console:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env php
2 | =7.2.5",
8 | "ext-ctype": "*",
9 | "ext-iconv": "*",
10 | "api-platform/core": "^2.6",
11 | "composer/package-versions-deprecated": "1.11.99.4",
12 | "doctrine/annotations": "^1.0",
13 | "doctrine/doctrine-bundle": "^2.4",
14 | "doctrine/doctrine-migrations-bundle": "^3.2",
15 | "doctrine/orm": "^2.10",
16 | "nelmio/cors-bundle": "^2.1",
17 | "phpdocumentor/reflection-docblock": "^5.3",
18 | "symfony/asset": "5.3.*",
19 | "symfony/console": "5.3.*",
20 | "symfony/dotenv": "5.3.*",
21 | "symfony/expression-language": "5.3.*",
22 | "symfony/flex": "^1.3.1",
23 | "symfony/framework-bundle": "5.3.*",
24 | "symfony/messenger": "5.3.*",
25 | "symfony/property-access": "5.3.*",
26 | "symfony/property-info": "5.3.*",
27 | "symfony/proxy-manager-bridge": "5.3.*",
28 | "symfony/runtime": "5.3.*",
29 | "symfony/security-bundle": "5.3.*",
30 | "symfony/serializer": "5.3.*",
31 | "symfony/twig-bundle": "5.3.*",
32 | "symfony/validator": "5.3.*",
33 | "symfony/yaml": "5.3.*"
34 | },
35 | "require-dev": {
36 | "phpunit/phpunit": "^9.5",
37 | "symfony/browser-kit": "5.3.*",
38 | "symfony/css-selector": "5.3.*",
39 | "symfony/debug-bundle": "5.3.*",
40 | "symfony/monolog-bundle": "^3.0",
41 | "symfony/phpunit-bridge": "^5.3",
42 | "symfony/stopwatch": "5.3.*",
43 | "symfony/web-profiler-bundle": "5.3.*"
44 | },
45 | "config": {
46 | "optimize-autoloader": true,
47 | "preferred-install": {
48 | "*": "dist"
49 | },
50 | "sort-packages": true
51 | },
52 | "autoload": {
53 | "psr-4": {
54 | "Domain\\": "src/Domain",
55 | "Application\\": "src/Application",
56 | "Infrastructure\\": "src/Infrastructure"
57 | }
58 | },
59 | "autoload-dev": {
60 | "psr-4": {
61 | "App\\Tests\\": "tests/"
62 | }
63 | },
64 | "replace": {
65 | "symfony/polyfill-ctype": "*",
66 | "symfony/polyfill-iconv": "*",
67 | "symfony/polyfill-php72": "*"
68 | },
69 | "scripts": {
70 | "auto-scripts": {
71 | "cache:clear": "symfony-cmd",
72 | "assets:install %PUBLIC_DIR%": "symfony-cmd"
73 | },
74 | "post-install-cmd": [
75 | "@auto-scripts"
76 | ],
77 | "post-update-cmd": [
78 | "@auto-scripts"
79 | ]
80 | },
81 | "conflict": {
82 | "symfony/symfony": "*"
83 | },
84 | "extra": {
85 | "symfony": {
86 | "allow-contrib": false,
87 | "require": "5.3.*"
88 | }
89 | }
90 | }
91 |
--------------------------------------------------------------------------------
/config/bundles.php:
--------------------------------------------------------------------------------
1 | ['all' => true],
5 | Symfony\Bundle\TwigBundle\TwigBundle::class => ['all' => true],
6 | Symfony\Bundle\SecurityBundle\SecurityBundle::class => ['all' => true],
7 | Doctrine\Bundle\DoctrineBundle\DoctrineBundle::class => ['all' => true],
8 | Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle::class => ['all' => true],
9 | Nelmio\CorsBundle\NelmioCorsBundle::class => ['all' => true],
10 | ApiPlatform\Core\Bridge\Symfony\Bundle\ApiPlatformBundle::class => ['all' => true],
11 | Symfony\Bundle\WebProfilerBundle\WebProfilerBundle::class => ['dev' => true, 'test' => true],
12 | Symfony\Bundle\MonologBundle\MonologBundle::class => ['all' => true],
13 | Symfony\Bundle\DebugBundle\DebugBundle::class => ['dev' => true],
14 | ];
15 |
--------------------------------------------------------------------------------
/config/packages/api_platform.yaml:
--------------------------------------------------------------------------------
1 | api_platform:
2 | mapping:
3 | paths:
4 | - '%kernel.project_dir%/src/Application/Panda/Command'
5 | - '%kernel.project_dir%/src/Domain/Panda/Model'
6 | patch_formats:
7 | json: ['application/merge-patch+json']
8 | swagger:
9 | versions: [3]
10 | exception_to_status:
11 | Application\Panda\Exception\PandaNotFoundException: 404
12 |
--------------------------------------------------------------------------------
/config/packages/cache.yaml:
--------------------------------------------------------------------------------
1 | framework:
2 | cache:
3 | # Unique name of your app: used to compute stable namespaces for cache keys.
4 | #prefix_seed: your_vendor_name/app_name
5 |
6 | # The "app" cache stores to the filesystem by default.
7 | # The data in this cache should persist between deploys.
8 | # Other options include:
9 |
10 | # Redis
11 | #app: cache.adapter.redis
12 | #default_redis_provider: redis://localhost
13 |
14 | # APCu (not recommended with heavy random-write workloads as memory fragmentation can cause perf issues)
15 | #app: cache.adapter.apcu
16 |
17 | # Namespaced pools use the above "app" backend by default
18 | #pools:
19 | #my.dedicated.cache: null
20 |
--------------------------------------------------------------------------------
/config/packages/dev/debug.yaml:
--------------------------------------------------------------------------------
1 | debug:
2 | # Forwards VarDumper Data clones to a centralized server allowing to inspect dumps on CLI or in your browser.
3 | # See the "server:dump" command to start a new server.
4 | dump_destination: "tcp://%env(VAR_DUMPER_SERVER)%"
5 |
--------------------------------------------------------------------------------
/config/packages/dev/monolog.yaml:
--------------------------------------------------------------------------------
1 | monolog:
2 | handlers:
3 | main:
4 | type: stream
5 | path: "%kernel.logs_dir%/%kernel.environment%.log"
6 | level: debug
7 | channels: ["!event"]
8 | # uncomment to get logging in your browser
9 | # you may have to allow bigger header sizes in your Web server configuration
10 | #firephp:
11 | # type: firephp
12 | # level: info
13 | #chromephp:
14 | # type: chromephp
15 | # level: info
16 | console:
17 | type: console
18 | process_psr_3_messages: false
19 | channels: ["!event", "!doctrine", "!console"]
20 |
--------------------------------------------------------------------------------
/config/packages/dev/web_profiler.yaml:
--------------------------------------------------------------------------------
1 | web_profiler:
2 | toolbar: true
3 | intercept_redirects: false
4 |
5 | framework:
6 | profiler: { only_exceptions: false }
7 |
--------------------------------------------------------------------------------
/config/packages/doctrine.yaml:
--------------------------------------------------------------------------------
1 | doctrine:
2 | dbal:
3 | url: '%env(resolve:DATABASE_URL)%'
4 | orm:
5 | auto_generate_proxy_classes: true
6 | naming_strategy: doctrine.orm.naming_strategy.underscore_number_aware
7 | auto_mapping: true
8 | mappings:
9 | Panda_Model:
10 | is_bundle: false
11 | type: attribute
12 | dir: '%kernel.project_dir%/src/Domain/Panda/Model'
13 | prefix: 'Domain\Panda\Model'
14 | alias: Panda
15 |
--------------------------------------------------------------------------------
/config/packages/doctrine_migrations.yaml:
--------------------------------------------------------------------------------
1 | doctrine_migrations:
2 | migrations_paths:
3 | 'DoctrineMigrations': '%kernel.project_dir%/migrations'
4 | enable_profiler: '%kernel.debug%'
5 |
--------------------------------------------------------------------------------
/config/packages/framework.yaml:
--------------------------------------------------------------------------------
1 | # see https://symfony.com/doc/current/reference/configuration/framework.html
2 | framework:
3 | secret: '%env(APP_SECRET)%'
4 | #csrf_protection: true
5 | http_method_override: false
6 |
7 | # Enables session support. Note that the session will ONLY be started if you read or write from it.
8 | # Remove or comment this section to explicitly disable session support.
9 | session:
10 | handler_id: null
11 | cookie_secure: auto
12 | cookie_samesite: lax
13 | storage_factory_id: session.storage.factory.native
14 |
15 | #esi: true
16 | #fragments: true
17 | php_errors:
18 | log: true
19 |
20 | when@test:
21 | framework:
22 | test: true
23 | session:
24 | storage_factory_id: session.storage.factory.mock_file
25 |
--------------------------------------------------------------------------------
/config/packages/messenger.yaml:
--------------------------------------------------------------------------------
1 | framework:
2 | messenger:
3 | transports:
4 | sync: 'sync://'
5 | routing:
6 | 'Application\Panda\Command\FeedPanda': sync
7 |
--------------------------------------------------------------------------------
/config/packages/nelmio_cors.yaml:
--------------------------------------------------------------------------------
1 | nelmio_cors:
2 | defaults:
3 | origin_regex: true
4 | allow_origin: ['%env(CORS_ALLOW_ORIGIN)%']
5 | allow_methods: ['GET', 'OPTIONS', 'POST', 'PUT', 'PATCH', 'DELETE']
6 | allow_headers: ['Content-Type', 'Authorization']
7 | expose_headers: ['Link']
8 | max_age: 3600
9 | paths:
10 | '^/': null
11 |
--------------------------------------------------------------------------------
/config/packages/prod/deprecations.yaml:
--------------------------------------------------------------------------------
1 | # As of Symfony 5.1, deprecations are logged in the dedicated "deprecation" channel when it exists
2 | #monolog:
3 | # channels: [deprecation]
4 | # handlers:
5 | # deprecation:
6 | # type: stream
7 | # channels: [deprecation]
8 | # path: php://stderr
9 |
--------------------------------------------------------------------------------
/config/packages/prod/doctrine.yaml:
--------------------------------------------------------------------------------
1 | doctrine:
2 | orm:
3 | auto_generate_proxy_classes: false
4 | query_cache_driver:
5 | type: pool
6 | pool: doctrine.system_cache_pool
7 | result_cache_driver:
8 | type: pool
9 | pool: doctrine.result_cache_pool
10 |
11 | framework:
12 | cache:
13 | pools:
14 | doctrine.result_cache_pool:
15 | adapter: cache.app
16 | doctrine.system_cache_pool:
17 | adapter: cache.system
18 |
--------------------------------------------------------------------------------
/config/packages/prod/monolog.yaml:
--------------------------------------------------------------------------------
1 | monolog:
2 | handlers:
3 | main:
4 | type: fingers_crossed
5 | action_level: error
6 | handler: nested
7 | excluded_http_codes: [404, 405]
8 | buffer_size: 50 # How many messages should be saved? Prevent memory leaks
9 | nested:
10 | type: stream
11 | path: php://stderr
12 | level: debug
13 | formatter: monolog.formatter.json
14 | console:
15 | type: console
16 | process_psr_3_messages: false
17 | channels: ["!event", "!doctrine"]
18 |
--------------------------------------------------------------------------------
/config/packages/routing.yaml:
--------------------------------------------------------------------------------
1 | framework:
2 | router:
3 | utf8: true
4 |
5 | # Configure how to generate URLs in non-HTTP contexts, such as CLI commands.
6 | # See https://symfony.com/doc/current/routing.html#generating-urls-in-commands
7 | #default_uri: http://localhost
8 |
9 | when@prod:
10 | framework:
11 | router:
12 | strict_requirements: null
13 |
--------------------------------------------------------------------------------
/config/packages/security.yaml:
--------------------------------------------------------------------------------
1 | security:
2 | enable_authenticator_manager: true
3 | # https://symfony.com/doc/current/security.html#registering-the-user-hashing-passwords
4 | password_hashers:
5 | Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface: 'auto'
6 | # https://symfony.com/doc/current/security.html#loading-the-user-the-user-provider
7 | providers:
8 | users_in_memory: { memory: null }
9 | firewalls:
10 | dev:
11 | pattern: ^/(_(profiler|wdt)|css|images|js)/
12 | security: false
13 | main:
14 | lazy: true
15 | provider: users_in_memory
16 |
17 | # activate different ways to authenticate
18 | # https://symfony.com/doc/current/security.html#the-firewall
19 |
20 | # https://symfony.com/doc/current/security/impersonating_user.html
21 | # switch_user: true
22 |
23 | # Easy way to control access for large sections of your site
24 | # Note: Only the *first* access control that matches will be used
25 | access_control:
26 | # - { path: ^/admin, roles: ROLE_ADMIN }
27 | # - { path: ^/profile, roles: ROLE_USER }
28 |
--------------------------------------------------------------------------------
/config/packages/test/doctrine.yaml:
--------------------------------------------------------------------------------
1 | doctrine:
2 | dbal:
3 | # "TEST_TOKEN" is typically set by ParaTest
4 | dbname_suffix: '_test%env(default::TEST_TOKEN)%'
5 |
--------------------------------------------------------------------------------
/config/packages/test/monolog.yaml:
--------------------------------------------------------------------------------
1 | monolog:
2 | handlers:
3 | main:
4 | type: fingers_crossed
5 | action_level: error
6 | handler: nested
7 | excluded_http_codes: [404, 405]
8 | channels: ["!event"]
9 | nested:
10 | type: stream
11 | path: "%kernel.logs_dir%/%kernel.environment%.log"
12 | level: debug
13 |
--------------------------------------------------------------------------------
/config/packages/test/validator.yaml:
--------------------------------------------------------------------------------
1 | framework:
2 | validation:
3 | not_compromised_password: false
4 |
--------------------------------------------------------------------------------
/config/packages/test/web_profiler.yaml:
--------------------------------------------------------------------------------
1 | web_profiler:
2 | toolbar: false
3 | intercept_redirects: false
4 |
5 | framework:
6 | profiler: { collect: false }
7 |
--------------------------------------------------------------------------------
/config/packages/twig.yaml:
--------------------------------------------------------------------------------
1 | twig:
2 | default_path: '%kernel.project_dir%/templates'
3 |
4 | when@test:
5 | twig:
6 | strict_variables: true
7 |
--------------------------------------------------------------------------------
/config/packages/validator.yaml:
--------------------------------------------------------------------------------
1 | framework:
2 | validation:
3 | email_validation_mode: html5
4 |
5 | # Enables validator auto-mapping support.
6 | # For instance, basic validation constraints will be inferred from Doctrine's metadata.
7 | #auto_mapping:
8 | # App\Entity\: []
9 |
--------------------------------------------------------------------------------
/config/preload.php:
--------------------------------------------------------------------------------
1 | addSql('CREATE TABLE panda (id INTEGER NOT NULL, hunger_amount INTEGER NOT NULL, PRIMARY KEY(id))');
19 | }
20 |
21 | public function down(Schema $schema): void
22 | {
23 | // this down() migration is auto-generated, please modify it to your needs
24 | $this->addSql('DROP TABLE panda');
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/phpunit.xml.dist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |