4 |
5 | {% block title %}Welcome!{% endblock %}
6 | {% block stylesheets %}{% endblock %}
7 |
8 |
9 |
10 | {% block body %}{% endblock %}
11 | {% block javascripts %}{% endblock %}
12 |
13 |
14 |
--------------------------------------------------------------------------------
/app/config/config.yml:
--------------------------------------------------------------------------------
1 |
2 | framework:
3 | charset: UTF-8
4 | router: { resource: "%kernel.root_dir%/config/routing.yml" }
5 | validation: true
6 | templating: { engines: ['twig'] } #assets_version: SomeVersionScheme
7 | session:
8 | lifetime: 3600
9 | auto_start: true
10 | secret: xxxxxxxxx # you may change it
11 |
12 | # Twig Configuration
13 | twig:
14 | debug: %kernel.debug%
15 | strict_variables: %kernel.debug%
16 |
17 |
--------------------------------------------------------------------------------
/app/console:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env php
2 | getParameterOption(array('--env', '-e'), 'dev');
12 | $debug = !$input->hasParameterOption(array('--no-debug', ''));
13 |
14 | $kernel = new AppKernel($env, $debug);
15 | $application = new Application($kernel);
16 | $application->run();
17 |
--------------------------------------------------------------------------------
/web/app_dev.php:
--------------------------------------------------------------------------------
1 | handle(Request::createFromGlobals())->send();
16 |
--------------------------------------------------------------------------------
/bin/init-submodule.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | file=$1
4 | if [ -z "$file" ]; then
5 | file=".gitmodules.dist"
6 | fi
7 |
8 | for cfg in `git config -f $file -l`
9 | do
10 | if [ -n "$path" ] && [ -z "$url" ]; then
11 | url=`echo $cfg | awk -F"submodule.*.url=" '{print $2}'`
12 | elif [ -n "$path" ] && [ -n "$url" ] && [ -z "$version" ]; then
13 | version=`echo $cfg | awk -F"submodule.*.version=" '{print $2}'`
14 | else
15 | path=`echo $cfg | awk -F"submodule.*.path=" '{print $2}'`
16 | fi
17 |
18 | if [ -n "$url" ] && [ -n "$path" ] && [ -n "$version" ]; then
19 | if [ -n "$2" ]; then
20 | git clone --depth $2 $url $path
21 | fi
22 | git submodule add $url $path
23 |
24 | if [ -n "$version" ]; then
25 | cd $path
26 | git checkout $version
27 | cd -
28 | fi
29 |
30 | url=""
31 | path=""
32 | version=""
33 | fi
34 | done
35 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright (c) 2004-2010 Fabien Potencier
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 |
--------------------------------------------------------------------------------
/app/autoload.php:
--------------------------------------------------------------------------------
1 | registerNamespaces(array(
9 | 'Symfony' => array(__DIR__.'/../vendor/symfony/src', __DIR__.'/../vendor/bundles'),
10 | 'Monolog' => __DIR__.'/../vendor/monolog/src',
11 | //'Assetic' => __DIR__.'/../vendor/assetic/src',
12 | //'Sensio' => __DIR__.'/../vendor/bundles',
13 | //'JMS' => __DIR__.'/../vendor/bundles',
14 | //'Doctrine\\Common' => __DIR__.'/../vendor/doctrine-common/lib',
15 | //'Doctrine\\DBAL' => __DIR__.'/../vendor/doctrine-dbal/lib',
16 | //'Doctrine' => __DIR__.'/../vendor/doctrine/lib',
17 | ));
18 | $loader->registerPrefixes(array(
19 | //'Twig_Extensions_' => __DIR__.'/../vendor/twig-extensions/lib',
20 | 'Twig_' => __DIR__.'/../vendor/twig/lib',
21 | //'Swift_' => __DIR__.'/../vendor/swiftmailer/lib/classes',
22 | ));
23 | $loader->register();
24 |
--------------------------------------------------------------------------------
/app/config/security.yml.dist:
--------------------------------------------------------------------------------
1 | security:
2 | encoders:
3 | Symfony\Component\Security\Core\User\User: plaintext
4 |
5 | providers:
6 | in_memory:
7 | users:
8 | user: { password: userpass, roles: [ 'ROLE_USER' ] }
9 | admin: { password: adminpass, roles: [ 'ROLE_ADMIN' ] }
10 |
11 | firewalls:
12 | profiler:
13 | pattern: /_profiler.*
14 | security: false
15 |
16 | wdt:
17 | pattern: /_wdt.*
18 | security: false
19 |
20 | login:
21 | pattern: /demo/secured/login
22 | security: false
23 |
24 | secured_area:
25 | pattern: /demo/secured/.*
26 | form_login:
27 | check_path: /demo/secured/login_check
28 | login_path: /demo/secured/login
29 | logout:
30 | path: /demo/secured/logout
31 | target: /demo/
32 | #anonymous: ~
33 | #http_basic:
34 | # realm: "Secured Demo Area"
35 |
36 | access_control:
37 | #- { path: /login, roles: IS_AUTHENTICATED_ANONYMOUSLY, requires_channel: https }
38 |
--------------------------------------------------------------------------------
/app/phpunit.xml.dist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
14 |
15 |
16 | ../src/*/*Bundle/Tests
17 | ../src/*/Bundle/*Bundle/Tests
18 |
19 |
20 |
21 |
26 |
27 |
28 |
29 | ../src
30 |
31 | ../src/*/*Bundle/Resources
32 | ../src/*/*Bundle/Tests
33 | ../src/*/Bundle/*Bundle/Resources
34 | ../src/*/Bundle/*Bundle/Tests
35 |
36 |
37 |
38 |
39 |
--------------------------------------------------------------------------------
/app/config/config.yml.dist:
--------------------------------------------------------------------------------
1 | imports:
2 | - { resource: security.yml }
3 |
4 | framework:
5 | charset: UTF-8
6 | router: { resource: "%kernel.root_dir%/config/routing.yml" }
7 | validation: { enabled: true }
8 | templating: { engines: ['twig'] }
9 | session:
10 | lifetime: 3600
11 | auto_start: true
12 | secret: xxxxxxxxxxxxxxxxxxxxx # you may want to change this
13 |
14 | # Twig Configuration
15 | twig:
16 | debug: %kernel.debug%
17 | strict_variables: %kernel.debug%
18 |
19 | # Assetic Configuration
20 | assetic:
21 | debug: %kernel.debug%
22 | use_controller: false
23 |
24 | # Doctrine Configuration
25 | doctrine:
26 | dbal:
27 | default_connection: default
28 | connections:
29 | default:
30 | driver: pdo_mysql
31 | host: localhost
32 | dbname: symfony_empty
33 | user: ~
34 | password: ~
35 |
36 | orm:
37 | auto_generate_proxy_classes: %kernel.debug%
38 | default_entity_manager: default
39 | entity_managers:
40 | default:
41 | mappings:
42 | FrameworkBundle: {}
43 |
44 |
45 | # Swiftmailer Configuration
46 | swiftmailer:
47 | transport: smtp
48 | host: localhost
49 | username: ~
50 | password: ~
51 |
52 | jms_security_extra:
53 | secure_controllers: true
54 | secure_all_services: false
55 |
--------------------------------------------------------------------------------
/app/AppKernel.php:
--------------------------------------------------------------------------------
1 | getEnvironment(), array('dev', 'test'))) {
26 | $bundles[] = new Symfony\Bundle\WebProfilerBundle\WebProfilerBundle();
27 | }
28 |
29 | return $bundles;
30 | }
31 |
32 | public function registerContainerConfiguration(LoaderInterface $loader)
33 | {
34 | $basename = __DIR__ . '/config/config_' . $this->getEnvironment();
35 |
36 | if (file_exists($basename . '_local.yml')) {
37 | $loader->load($basename . '_local.yml');
38 | } else {
39 | $loader->load($basename . '.yml');
40 | }
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | Symfony Light Edition
2 | =====================
3 |
4 | What's inside?
5 | --------------
6 |
7 | Symfony Light Edition comes pre-configured with the following bundles:
8 |
9 | * FrameworkBundle
10 | * MonologBundle
11 | * TwigBundle
12 |
13 | Optionally:
14 | * SecurityBundle ( see security.yml.dist file )
15 | * SensioFrameworkExtraBundle
16 | * SecurityExtraBundle ( see config.yml.dist file )
17 | * DoctrineBundle ( see config.yml.dist file )
18 | * SwiftmailerBundle ( see config.yml.dist file )
19 | * AsseticBundle
20 | * WebProfilerBundle (in dev/test env)
21 |
22 | Installation
23 | ------------
24 |
25 | This distribution is made to be extracted in an empty git repository, in order to initiate a new Symfony2 project.
26 | Nothing special, just extract and run it!
27 |
28 | You can simply download it via `https://github.com/knplabs/symfony-light/tarball/master` and unpack it.
29 |
30 | wget --no-check-certificate https://github.com/knplabs/symfony-light/tarball/master -O symfony-light-master.tar.gz
31 | tar -xzvf symfony-light-master.tar.gz
32 | mv *-symfony-light-* my-project
33 | cd my-project
34 |
35 | Vendors, or how to use submodules
36 | ---------------------------------
37 |
38 | **This requires you to be in a working git repository, at root level.**
39 | If you are not, you can init a new repository in the current folder by simply typing:
40 |
41 | git init
42 |
43 | Run the following script:
44 |
45 | * `./bin/init-submodule.sh [.gitmodules.dist] [1]
46 |
47 | * [.gitmodules.dist] is a gitmodule file containing all needed vendors. If ommited, ``.gitmodules.dist`` is used
48 | * [1] is the git clone depth to limit history, and thus, filesystem size of vendors. If ommited, all history will be cloned
49 |
50 | This script automates the creation of submodules, but you still can do it manually via:
51 |
52 | git submodule add vendor/
53 |
54 |
55 | Last but not least, setup assets using:
56 |
57 | ./app/console assets:install web --symlink
58 |
59 |
60 | Configuration
61 | -------------
62 |
63 | **You don't need to configure anything** by default, as the basic configuration file works out of the box.
64 |
65 | The distribution is configured with the following defaults:
66 |
67 | * Twig is the only configured template engine;
68 | * Doctrine ORM/DBAL is deactivated ( see config.yml.dist file );
69 | * Swiftmailer is deactivated ( see config.yml.dist file );
70 | * Annotations for everything are enabled ( see config.yml.dist file ).
71 |
72 |
73 | Custom config
74 | -------------
75 |
76 | If you have special configurations depending on your machine or environment, you can override any config_*.yml.
77 |
78 | For example, if you have a different database password than the default one, you can modifiy it by adding a file named `config_dev_local.yml`:
79 |
80 | imports:
81 | - { resource: config_dev.yml }
82 |
83 | doctrine:
84 | dbal:
85 | connections:
86 | default:
87 | dbname: my_symfony_light_special_db_name
88 | user: florian
89 | password: chaaaangeMe
90 |
91 |
92 | If you want to use the CLI, a console application is available at
93 | `app/console`.
94 |
95 | Enjoy!
96 |
--------------------------------------------------------------------------------
/.gitmodules.full.dist:
--------------------------------------------------------------------------------
1 | [submodule "vendor/symfony"]
2 | path = vendor/symfony
3 | url = git://github.com/symfony/symfony.git
4 | version = master
5 | [submodule "vendor/monolog"]
6 | path = vendor/monolog
7 | url = git://github.com/Seldaek/monolog.git
8 | version = master
9 | [submodule "vendor/assetic"]
10 | path = vendor/assetic
11 | url = git://github.com/kriswallsmith/assetic.git
12 | version = master
13 | [submodule "vendor/doctrine-common"]
14 | path = vendor/doctrine-common
15 | url = git://github.com/doctrine/common.git
16 | version = master
17 | [submodule "vendor/twig"]
18 | path = vendor/twig
19 | url = git://github.com/fabpot/Twig.git
20 | version = master
21 | [submodule "vendor/twig-extensions"]
22 | path = vendor/twig-extensions
23 | url = git://github.com/fabpot/Twig-extensions.git
24 | version = master
25 | [submodule "vendor/bundles/Symfony/Bundle/DoctrineMongoDBBundle"]
26 | path = vendor/bundles/Symfony/Bundle/DoctrineMongoDBBundle
27 | url = git://github.com/symfony/DoctrineMongoDBBundle.git
28 | version = master
29 | [submodule "vendor/bundles/Sensio/Bundle/FrameworkExtraBundle"]
30 | path = vendor/bundles/Sensio/Bundle/FrameworkExtraBundle
31 | url = git://github.com/sensio/SensioFrameworkExtraBundle.git
32 | version = master
33 | [submodule "vendor/gedmo-doctrine-extensions"]
34 | path = vendor/gedmo-doctrine-extensions
35 | url = git://github.com/l3pp4rd/DoctrineExtensions.git
36 | version = master
37 | [submodule "vendor/doctrine-mongodb-odm"]
38 | path = vendor/doctrine-mongodb-odm
39 | url = git://github.com/doctrine/mongodb-odm.git
40 | version = master
41 | [submodule "vendor/doctrine-mongodb"]
42 | path = vendor/doctrine-mongodb
43 | url = git://github.com/doctrine/mongodb.git
44 | version = master
45 | [submodule "vendor/Behat/BehatBundle"]
46 | path = vendor/Behat/BehatBundle
47 | url = git://github.com/Behat/BehatBundle.git
48 | version = master
49 | [submodule "vendor/Behat/Gherkin"]
50 | path = vendor/Behat/Gherkin
51 | url = git://github.com/Behat/Gherkin.git
52 | version = master
53 | [submodule "vendor/Behat/Behat"]
54 | path = vendor/Behat/Behat
55 | url = git://github.com/Behat/Behat.git
56 | version = master
57 | [submodule "vendor/Behat/Mink"]
58 | path = vendor/Behat/Mink
59 | url = git://github.com/Behat/Mink.git
60 | version = master
61 | [submodule "vendor/Behat/MinkBundle"]
62 | path = vendor/Behat/MinkBundle
63 | url = git://github.com/Behat/MinkBundle.git
64 | version = master
65 | [submodule "vendor/Behat/SahiClient"]
66 | path = vendor/Behat/SahiClient
67 | url = git://github.com/Behat/SahiClient.git
68 | version = master
69 | [submodule "vendor/Buzz"]
70 | path = vendor/Buzz
71 | url = git://github.com/kriswallsmith/Buzz.git
72 | version = master
73 | [submodule "vendor/bundles/Symfony/Bundle/DoctrineFixturesBundle"]
74 | path = vendor/bundles/Symfony/Bundle/DoctrineFixturesBundle
75 | url = git://github.com/symfony/DoctrineFixturesBundle.git
76 | version = master
77 | [submodule "vendor/doctrine-data-fixtures"]
78 | path = vendor/doctrine-data-fixtures
79 | url = git://github.com/doctrine/data-fixtures.git
80 | version = master
81 | [submodule "vendor/bundles/Stof/DoctrineExtensionsBundle"]
82 | path = vendor/bundles/Stof/DoctrineExtensionsBundle
83 | url = git://github.com/stof/StofDoctrineExtensionsBundle.git
84 | version = master
85 | [submodule "vendor/bundles/Symfony/Bundle/AsseticBundle"]
86 | path = vendor/bundles/Symfony/Bundle/AsseticBundle
87 | url = git://github.com/symfony/AsseticBundle.git
88 | version = master
89 |
--------------------------------------------------------------------------------
/app/check.php:
--------------------------------------------------------------------------------
1 |
23 |
24 |
32 |
33 |
34 |
35 | REQUIREMENTS CHECK
36 | EOF
37 | ;
38 | echo sprintf("
php.ini used by PHP: %s
", get_ini_path());
39 | }
40 |
41 | // mandatory
42 | echo_title("Mandatory requirements");
43 | check(version_compare(phpversion(), '5.3.2', '>='), sprintf('Checking that PHP version is at least 5.3.2 (%s installed)', phpversion()), 'Install PHP 5.3.1 or newer (current version is '.phpversion(), true);
44 | check(ini_get('date.timezone'), 'Checking that the "date.timezone" setting is set', 'Set the "date.timezone" setting in php.ini (like Europe/Paris)', true);
45 | check(is_writable(__DIR__.'/../app/cache'), sprintf('Checking that app/cache/ directory is writable'), 'Change the permissions of the app/cache/ directory so that the web server can write in it', true);
46 | check(is_writable(__DIR__.'/../app/logs'), sprintf('Checking that the app/logs/ directory is writable'), 'Change the permissions of the app/logs/ directory so that the web server can write in it', true);
47 |
48 | // warnings
49 | echo_title("Optional checks");
50 | check(class_exists('DomDocument'), 'Checking that the PHP-XML module is installed', 'Install and enable the php-xml module', false);
51 | check(defined('LIBXML_COMPACT'), 'Checking that the libxml version is at least 2.6.21', 'Upgrade your php-xml module with a newer libxml', false);
52 | check(function_exists('token_get_all'), 'Checking that the token_get_all() function is available', 'Install and enable the Tokenizer extension (highly recommended)', false);
53 | check(function_exists('mb_strlen'), 'Checking that the mb_strlen() function is available', 'Install and enable the mbstring extension', false);
54 | check(function_exists('iconv'), 'Checking that the iconv() function is available', 'Install and enable the iconv extension', false);
55 | check(function_exists('utf8_decode'), 'Checking that the utf8_decode() is available', 'Install and enable the XML extension', false);
56 | check(function_exists('posix_isatty'), 'Checking that the posix_isatty() is available', 'Install and enable the php_posix extension (used to colorized the CLI output)', false);
57 | check(class_exists('Locale'), 'Checking that the intl extension is available', 'Install and enable the intl extension (used for validators)', false);
58 |
59 | $accelerator =
60 | (function_exists('apc_store') && ini_get('apc.enabled'))
61 | ||
62 | function_exists('eaccelerator_put') && ini_get('eaccelerator.enable')
63 | ||
64 | function_exists('xcache_set')
65 | ;
66 | check($accelerator, 'Checking that a PHP accelerator is installed', 'Install a PHP accelerator like APC (highly recommended)', false);
67 |
68 | check(!ini_get('short_open_tag'), 'Checking that php.ini has short_open_tag set to off', 'Set short_open_tag to off in php.ini', false);
69 | check(!ini_get('magic_quotes_gpc'), 'Checking that php.ini has magic_quotes_gpc set to off', 'Set magic_quotes_gpc to off in php.ini', false);
70 | check(!ini_get('register_globals'), 'Checking that php.ini has register_globals set to off', 'Set register_globals to off in php.ini', false);
71 | check(!ini_get('session.auto_start'), 'Checking that php.ini has session.auto_start set to off', 'Set session.auto_start to off in php.ini', false);
72 |
73 | echo_title("Optional checks (Doctrine)");
74 |
75 | check(class_exists('PDO'), 'Checking that PDO is installed', 'Install PDO (mandatory for Doctrine)', false);
76 | if (class_exists('PDO')) {
77 | $drivers = PDO::getAvailableDrivers();
78 | check(count($drivers), 'Checking that PDO has some drivers installed: '.implode(', ', $drivers), 'Install PDO drivers (mandatory for Doctrine)');
79 | }
80 |
81 | if (!is_cli()) {
82 | echo '