Skip to content

Commit 1c82de0

Browse files
committed
Add symfony 3.4 with micro-framework-bundle
1 parent cb8d2ea commit 1c82de0

27 files changed

+1420
-0
lines changed

list.sh

+1
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ staticphp-0.9
4242
symfony-3.0
4343
symfony-3.4
4444
symfony-3.4-micro
45+
symfony-3.4-empty
4546
tipsy-0.10
4647
#typo3f-2.3 # does not work
4748
#typo3f-3.0 # Catchable Fatal Error: Argument 1 passed to TYPO3\Flow\Object\ObjectManager::setObjects() must be of the type array, null given

symfony-3.4-empty/.gitignore

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Temporary Files
2+
/var/*
3+
4+
!/var/cache
5+
/var/cache/*
6+
!var/cache/.gitkeep
7+
8+
!/var/logs
9+
/var/logs/*
10+
!var/logs/.gitkeep
11+
12+
# Configuration
13+
/app/config/parameters.yml
14+
15+
# Third Party libraries
16+
/vendor/
17+
/composer.phar

symfony-3.4-empty/LICENSE

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
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.

symfony-3.4-empty/README.md

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
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+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/bin/sh
2+
3+
url="$base/$fw/web/app.php/hello/index"

symfony-3.4-empty/_benchmark/setup.sh

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/bin/sh
2+
3+
export SYMFONY_ENV=prod
4+
composer install --no-dev --optimize-autoloader
5+
php bin/console cache:clear --env=prod --no-debug --no-warmup
6+
php bin/console cache:warmup --env=prod --no-debug
7+
chmod o+w var/cache/ var/logs/
8+
chmod -R o+w var/cache/*

symfony-3.4-empty/app/AppKernel.php

+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
<?php
2+
// app/AppKernel.php
3+
4+
use AppBundle\Kernel\MicroKernelTrait;
5+
use Symfony\Component\DependencyInjection\ContainerBuilder;
6+
use Symfony\Component\HttpKernel\Kernel;
7+
use Symfony\Component\Config\Loader\LoaderInterface;
8+
use Symfony\Component\Routing\RouteCollectionBuilder;
9+
10+
class AppKernel extends Kernel
11+
{
12+
use MicroKernelTrait;
13+
14+
public function registerBundles()
15+
{
16+
$bundles = [
17+
new Gnugat\MicroFrameworkBundle\GnugatMicroFrameworkBundle(),
18+
// new Symfony\Bundle\MonologBundle\MonologBundle(),
19+
];
20+
21+
return $bundles;
22+
}
23+
24+
protected function configureRoutes(RouteCollectionBuilder $routes)
25+
{
26+
$routes->add('/hello/index', \AppBundle\Controller\HelloController::class . '::indexAction');
27+
}
28+
29+
public function getRootDir()
30+
{
31+
return __DIR__;
32+
}
33+
34+
public function getCacheDir()
35+
{
36+
return dirname(__DIR__) . '/var/cache/' . $this->getEnvironment();
37+
}
38+
39+
public function getLogDir()
40+
{
41+
return dirname(__DIR__) . '/var/logs';
42+
}
43+
44+
protected function configureContainer(ContainerBuilder $c, LoaderInterface $loader)
45+
{
46+
$loader->load($this->getRootDir() . '/config/config_' . $this->getEnvironment() . '.yml');
47+
}
48+
}

symfony-3.4-empty/app/autoload.php

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<?php
2+
3+
require __DIR__.'/../vendor/autoload.php';
+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#imports:
2+
# - { resource: parameters.yml }
3+
# - { resource: services/ }
4+
#
5+
#framework:
6+
# secret: '%secret%'
7+
# router:
8+
# resource: '%kernel.root_dir%/config/routings/'
9+
# type: directory
10+
11+
# app/config/config.yml
12+
imports:
13+
- { resource: parameters.yml }
14+
15+
#framework:
16+
# secret: "%secret%"
17+
# router:
18+
# resource: "%kernel.root_dir%/config/routings.yml"
19+
20+
services:
21+
app.hello_controller:
22+
class: AppBundle\Controller\HelloController
23+
tags: ['controller.service_arguments']
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
imports:
2+
- { resource: config.yml }
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
imports:
2+
- { resource: config.yml }
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
imports:
2+
- { resource: config_dev.yml }
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
parameters:
2+
secret: ThouShallChangeMe
+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
main_page:
2+
path: /
3+
defaults:
4+
_controller: app.hello_controller:worldAction
5+
methods:
6+
- GET
7+
hello_world:
8+
path: /hello/index
9+
defaults:
10+
_controller: app.hello_controller:worldAction
11+
methods:
12+
- GET

symfony-3.4-empty/app/config/routings/.gitkeep

Whitespace-only changes.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
main_page:
2+
path: /
3+
defaults:
4+
_controller: app.hello_controller:worldAction
5+
methods:
6+
- GET
7+
hello_world:
8+
path: /hello/index
9+
defaults:
10+
_controller: app.hello_controller:worldAction
11+
methods:
12+
- GET

symfony-3.4-empty/bin/console

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#!/usr/bin/env php
2+
<?php
3+
// bin/console
4+
5+
set_time_limit(0);
6+
7+
require_once __DIR__.'/../app/autoload.php';
8+
9+
use Gnugat\MicroFrameworkBundle\Service\KernelApplication;
10+
use Symfony\Component\Console\Input\ArgvInput;
11+
12+
$input = new ArgvInput();
13+
$env = $input->getParameterOption(array('--env', '-e'), 'dev');
14+
$debug = !$input->hasParameterOption(array('--no-debug', '')) && $env !== 'prod';
15+
16+
$kernel = new AppKernel($env, $debug);
17+
$application = new KernelApplication($kernel);
18+
$application->run($input);

symfony-3.4-empty/composer.json

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
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": { "": "src" },
8+
"files": [ "app/AppKernel.php" ]
9+
},
10+
"autoload-dev": {
11+
"psr-4": { "Tests\\": "tests" }
12+
},
13+
"require": {
14+
"php": "^5.5.9|^7.0",
15+
"symfony/console": "^3.0",
16+
"symfony/event-dispatcher": "^3.0",
17+
"symfony/finder": "^3.0",
18+
"symfony/yaml": "^3.0",
19+
"incenteev/composer-parameter-handler": "^2.1",
20+
"gnugat/micro-framework-bundle": "0.5.0"
21+
},
22+
"scripts": {
23+
"post-install-cmd": [
24+
"Incenteev\\ParameterHandler\\ScriptHandler::buildParameters"
25+
],
26+
"post-update-cmd": [
27+
"Incenteev\\ParameterHandler\\ScriptHandler::buildParameters"
28+
]
29+
},
30+
"extra": {
31+
"incenteev-parameters": [
32+
{ "file": "app/config/parameters.yml" }
33+
]
34+
}
35+
}

0 commit comments

Comments
 (0)