├── .gitignore ├── LICENSE ├── README.md ├── bin └── console ├── composer.json ├── config ├── bundles.php ├── routings │ ├── .gitkeep │ └── attributes.yaml ├── services.yaml ├── services │ └── .gitkeep └── services_test.yaml ├── src └── AppKernel.php ├── tests └── .gitkeep ├── var ├── cache │ └── .gitkeep └── logs │ └── .gitkeep └── web ├── app.php ├── favicon.ico └── robots.txt /.gitignore: -------------------------------------------------------------------------------- 1 | # Temporary Files 2 | /var/* 3 | 4 | !/var/cache 5 | /var/cache/* 6 | !var/cache/.gitkeep 7 | 8 | !config/services/.gitkeep 9 | !config/routings/.gitkeep 10 | 11 | !/var/logs 12 | /var/logs/* 13 | !var/logs/.gitkeep 14 | 15 | # Configuration 16 | /app/config/parameters.yaml 17 | 18 | # Third Party libraries 19 | /vendor/ 20 | /composer.phar 21 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2014-2015 Loïc Faugeron 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is furnished 8 | to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in all 11 | copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Symfony Empty Edition 2 | 3 | A skeleton allowing you to create an empty Symfony application: it is provided without 4 | any libraries or bundles (except for Symfony's FrameworkBundle). 5 | 6 | You can then start building on it, and install the dependencies you need. 7 | 8 | > **Note**: The [Symfony Standard Edition](https://github.com/symfony/symfony-standard) 9 | > provides a big set of libraries and bundles (database, email, templating, etc). 10 | > If you don't feel comfortable with picking your own yet, you should probably use it. 11 | 12 | ## Installation 13 | 14 | Use [Composer](https://getcomposer.org/) to create a new application: 15 | 16 | ``` 17 | composer create-project gnugat/symfony-empty-edition my-project 18 | ``` 19 | 20 | ## Differences with the Standard Edition 21 | 22 | * Only 2 bundles: `src/AppBundle` and `symfony/framework-bundle`, add the ones you really need 23 | * Only 1 front controller (`web/app.php`), change the environment using the `SYMFONY_ENV` environment variable 24 | * No annotations (can be brought back by installing `sensio/framework-extra-bundle`) 25 | 26 | ## Use cases 27 | 28 | There are many real world use cases for this distribution. Here's a small selection: 29 | 30 | * tailored made applications: for applications that require "non standard" dependencies (e.g. Propel or Pomm for the database, etc) 31 | * micro applications: for applications that don't need database, templating or mailing systems (Symfony can be a Micro Framework) 32 | * legacy migrations: for applications that need to depend on legacy database, templating, etc while migrating to symfony 33 | * teaching material: [better explained here](http://www.whitewashing.de/2014/04/24/symfony_hello_world.html) 34 | 35 | -------------------------------------------------------------------------------- /bin/console: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env php 2 | getParameterOption(['--env', '-e'], 'dev'); 14 | $debug = !$input->hasParameterOption(['--no-debug', '']) && $env !== 'prod'; 15 | 16 | $kernel = new AppKernel($env, $debug); 17 | $application = new Application($kernel); 18 | $application->run($input); 19 | -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "gnugat/symfony-empty-edition", 3 | "license": "MIT", 4 | "type": "project", 5 | "description": "The \"Symfony Empty Edition\" distribution", 6 | "autoload": { 7 | "psr-4": { "App\\": "src/" } 8 | }, 9 | "autoload-dev": { 10 | "psr-4": { "tests\\": "tests/" } 11 | }, 12 | "require": { 13 | "php": "^8.2", 14 | "symfony/console": "^7.1.8", 15 | "symfony/finder": "^7.1.6", 16 | "symfony/framework-bundle": "^7.1.6", 17 | "symfony/yaml": "^7.1.6" 18 | }, 19 | "config": { 20 | "bump-after-update": true, 21 | "sort-packages": true 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /config/bundles.php: -------------------------------------------------------------------------------- 1 | ['all' => true], 5 | ]; 6 | -------------------------------------------------------------------------------- /config/routings/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gnugat/symfony-empty-edition/378d4bcb92d0481903ff1cbe88824461831e92e6/config/routings/.gitkeep -------------------------------------------------------------------------------- /config/routings/attributes.yaml: -------------------------------------------------------------------------------- 1 | # Allows Route attrbiutes in controllers, for example: 2 | # 3 | # ```php 4 | # query->get('name', 'world'); 18 | # 19 | # return new Response(json_encode(['hello' => $name]), 200, [ 20 | # 'Content-Type' => 'application/json', 21 | # ]); 22 | # } 23 | # } 24 | # ``` 25 | controllers: 26 | resource: 27 | path: ../../src/Controller/ 28 | namespace: App\Controller 29 | type: attribute 30 | 31 | kernel: 32 | resource: App\AppKernel 33 | type: attribute 34 | -------------------------------------------------------------------------------- /config/services.yaml: -------------------------------------------------------------------------------- 1 | imports: 2 | - { resource: services/ } 3 | 4 | framework: 5 | router: 6 | resource: '%kernel.project_dir%/config/routings/' 7 | type: directory 8 | 9 | services: 10 | _defaults: 11 | autowire: true 12 | autoconfigure: true 13 | App\: 14 | resource: '../src/' 15 | exclude: 16 | - '../src/DependencyInjection/' 17 | - '../src/AppKernel.php' 18 | App\Controller\: 19 | resource: '../src/Controller/' 20 | tags: ['controller.service_arguments'] 21 | -------------------------------------------------------------------------------- /config/services/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gnugat/symfony-empty-edition/378d4bcb92d0481903ff1cbe88824461831e92e6/config/services/.gitkeep -------------------------------------------------------------------------------- /config/services_test.yaml: -------------------------------------------------------------------------------- 1 | imports: 2 | - { resource: services.yaml } 3 | -------------------------------------------------------------------------------- /src/AppKernel.php: -------------------------------------------------------------------------------- 1 | $envs) { 16 | if ($envs[$this->environment] ?? $envs['all'] ?? false) { 17 | yield new $class(); 18 | } 19 | } 20 | } 21 | 22 | #[\Override] 23 | public function registerContainerConfiguration(LoaderInterface $loader): void 24 | { 25 | // Configure container 26 | $configFilename = __DIR__.'/../config/services.yaml'; 27 | $configEnvFilename = __DIR__."/../config/services_{$this->environment}.yaml"; 28 | if (is_file($configEnvFilename)) { 29 | $configFilename = $configEnvFilename; 30 | } 31 | $loader->load($configFilename); 32 | } 33 | 34 | #[\Override] 35 | public function getProjectDir(): string 36 | { 37 | // Points to the app's path where the `composer.json` is. 38 | // An implemenation for this is already provided in `Kernel`, but here we provide a solution that's more simple. 39 | return __DIR__.'/..'; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /tests/.gitkeep: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /var/cache/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gnugat/symfony-empty-edition/378d4bcb92d0481903ff1cbe88824461831e92e6/var/cache/.gitkeep -------------------------------------------------------------------------------- /var/logs/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gnugat/symfony-empty-edition/378d4bcb92d0481903ff1cbe88824461831e92e6/var/logs/.gitkeep -------------------------------------------------------------------------------- /web/app.php: -------------------------------------------------------------------------------- 1 | handle($request); 15 | $response->send(); 16 | $kernel->terminate($request, $response); 17 | -------------------------------------------------------------------------------- /web/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gnugat/symfony-empty-edition/378d4bcb92d0481903ff1cbe88824461831e92e6/web/favicon.ico -------------------------------------------------------------------------------- /web/robots.txt: -------------------------------------------------------------------------------- 1 | # www.robotstxt.org/ 2 | # www.google.com/support/webmasters/bin/answer.py?hl=en&answer=156449 3 | 4 | User-agent: * 5 | --------------------------------------------------------------------------------