Skip to content

Commit ef9a4c8

Browse files
committed
Add symfony-3.3 and symfony-3.3 with micro kernel
1 parent a4804cb commit ef9a4c8

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+7433
-0
lines changed

list.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ staticphp-0.9
4040
#symfony-2.6
4141
#symfony-2.7
4242
symfony-3.0
43+
symfony-3.3
44+
symfony-3.3-micro
4345
tipsy-0.10
4446
#typo3f-2.3 # does not work
4547
#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.3-micro/.gitignore

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
/app/config/parameters.yml
2+
/build/
3+
/phpunit.xml
4+
/var/*
5+
!/var/cache
6+
/var/cache/*
7+
!var/cache/.gitkeep
8+
!/var/logs
9+
/var/logs/*
10+
!var/logs/.gitkeep
11+
!/var/sessions
12+
/var/sessions/*
13+
!var/sessions/.gitkeep
14+
!var/SymfonyRequirements.php
15+
/vendor/
16+
/web/bundles/

symfony-3.3-micro/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
symfony-3.3
2+
===========
3+
4+
A Symfony project with [micro kernel](https://symfony.com/doc/current/configuration/micro_kernel_trait.html)
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/bin/sh
2+
3+
url="$base/$fw/web/micro.php/hello/index"

symfony-3.3-micro/_benchmark/setup.sh

Lines changed: 8 additions & 0 deletions
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.3-micro/app/AppCache.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?php
2+
3+
use Symfony\Bundle\FrameworkBundle\HttpCache\HttpCache;
4+
5+
class AppCache extends HttpCache
6+
{
7+
}

symfony-3.3-micro/app/AppKernel.php

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

symfony-3.3-micro/app/autoload.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?php
2+
3+
//use Doctrine\Common\Annotations\AnnotationRegistry;
4+
use Composer\Autoload\ClassLoader;
5+
6+
/**
7+
* @var ClassLoader $loader
8+
*/
9+
$loader = require __DIR__.'/../vendor/autoload.php';
10+
11+
//AnnotationRegistry::registerLoader([$loader, 'loadClass']);
12+
13+
return $loader;
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
imports:
2+
- { resource: parameters.yml }
3+
# - { resource: security.yml }
4+
- { resource: services.yml }
5+
6+
# Put parameters here that don't need to change on each machine where the app is deployed
7+
# http://symfony.com/doc/current/best_practices/configuration.html#application-related-configuration
8+
parameters:
9+
locale: en
10+
11+
framework:
12+
#esi: ~
13+
#translator: { fallbacks: ["%locale%"] }
14+
secret: "%secret%"
15+
#serializer: { enable_annotations: true }
16+
default_locale: "%locale%"
17+
trusted_hosts: ~
18+
trusted_proxies: ~
19+
session:
20+
# http://symfony.com/doc/current/reference/configuration/framework.html#handler-id
21+
handler_id: session.handler.native_file
22+
save_path: "%kernel.root_dir%/../var/sessions/%kernel.environment%"
23+
fragments: ~
24+
http_method_override: true
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
imports:
2+
- { resource: config.yml }
3+
4+
framework:
5+
profiler: { only_exceptions: false }
6+
7+
monolog:
8+
handlers:
9+
main:
10+
type: stream
11+
path: "%kernel.logs_dir%/%kernel.environment%.log"
12+
level: debug
13+
channels: [!event]
14+
console:
15+
type: console
16+
channels: [!event, !doctrine]
17+
# uncomment to get logging in your browser
18+
# you may have to allow bigger header sizes in your Web server configuration
19+
#firephp:
20+
# type: firephp
21+
# level: info
22+
#chromephp:
23+
# type: chromephp
24+
# level: info
25+
26+
#swiftmailer:
27+
# delivery_address: me@example.com
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
imports:
2+
- { resource: config.yml }
3+
4+
#framework:
5+
# validation:
6+
# cache: validator.mapping.cache.doctrine.apc
7+
# serializer:
8+
# cache: serializer.mapping.cache.doctrine.apc
9+
10+
#doctrine:
11+
# orm:
12+
# metadata_cache_driver: apc
13+
# result_cache_driver: apc
14+
# query_cache_driver: apc
15+
16+
monolog:
17+
handlers:
18+
main:
19+
type: fingers_crossed
20+
action_level: error
21+
handler: nested
22+
nested:
23+
type: stream
24+
path: "%kernel.logs_dir%/%kernel.environment%.log"
25+
level: debug
26+
console:
27+
type: console
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
imports:
2+
- { resource: config_dev.yml }
3+
4+
framework:
5+
test: ~
6+
session:
7+
storage_id: session.storage.mock_file
8+
profiler:
9+
collect: false
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# This file is a "template" of what your parameters.yml file should look like
2+
# Set parameters here that may be different on each deployment target of the app, e.g. development, staging, production.
3+
# http://symfony.com/doc/current/best_practices/configuration.html#infrastructure-related-configuration
4+
parameters:
5+
database_host: 127.0.0.1
6+
database_port: ~
7+
database_name: symfony
8+
database_user: root
9+
database_password: ~
10+
# You should uncomment this if you want use pdo_sqlite
11+
# database_path: "%kernel.root_dir%/data.db3"
12+
13+
mailer_transport: smtp
14+
mailer_host: 127.0.0.1
15+
mailer_user: ~
16+
mailer_password: ~
17+
18+
# A secret key that's used to generate certain security-related tokens
19+
secret: ThisTokenIsNotSoSecretChangeIt
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Learn more about services, parameters and containers at
2+
# http://symfony.com/doc/current/book/service_container.html
3+
parameters:
4+
# parameter_name: value
5+
6+
services:
7+
# service_name:
8+
# class: AppBundle\Directory\ClassName
9+
# arguments: ["@another_service_name", "plain_value", "%parameter_name%"]

symfony-3.3-micro/bin/console

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#!/usr/bin/env php
2+
<?php
3+
4+
use Symfony\Bundle\FrameworkBundle\Console\Application;
5+
use Symfony\Component\Console\Input\ArgvInput;
6+
use Symfony\Component\Debug\Debug;
7+
8+
// if you don't want to setup permissions the proper way, just uncomment the following PHP line
9+
// read http://symfony.com/doc/current/book/installation.html#configuration-and-setup for more information
10+
//umask(0000);
11+
12+
set_time_limit(0);
13+
14+
/**
15+
* @var Composer\Autoload\ClassLoader $loader
16+
*/
17+
$loader = require __DIR__.'/../app/autoload.php';
18+
19+
$input = new ArgvInput();
20+
$env = $input->getParameterOption(['--env', '-e'], getenv('SYMFONY_ENV') ?: 'dev');
21+
$debug = getenv('SYMFONY_DEBUG') !== '0' && !$input->hasParameterOption(['--no-debug', '']) && $env !== 'prod';
22+
23+
if ($debug) {
24+
Debug::enable();
25+
}
26+
27+
$kernel = new AppKernel($env, $debug);
28+
$application = new Application($kernel);
29+
$application->run($input);

0 commit comments

Comments
 (0)