├── .gitignore ├── .make ├── dev ├── symfony-test └── travisci-build ├── .scrutinizer.yml ├── .travis.yml ├── CONTRIBUTING.md ├── LICENSE ├── Makefile ├── Procfile ├── README.md ├── app ├── .htaccess ├── AppCache.php ├── AppKernel.php ├── Resources │ ├── FOSUserBundle │ │ └── views │ │ │ ├── Registration │ │ │ ├── register.html.twig │ │ │ └── register_content.html.twig │ │ │ ├── Security │ │ │ └── login.html.twig │ │ │ └── layout.html.twig │ └── views │ │ └── base.html.twig ├── SymfonyRequirements.php ├── autoload.php ├── cache │ └── .gitkeep ├── check.php ├── config │ ├── config.yml │ ├── config_dev.yml │ ├── config_prod.yml │ ├── config_test.yml │ ├── parameters.yml.dist │ ├── parameters_dev.yml │ ├── routing.yml │ ├── routing_dev.yml │ └── security.yml ├── console ├── logs │ └── .gitkeep └── phpunit.xml.dist ├── changelog ├── composer.json ├── composer.lock ├── doc ├── DefinitionOfDone.md ├── Localisation.md ├── PageLayout.md ├── Registration.md ├── Symfony.md ├── Versioning.md └── assets │ ├── contributing │ └── badges.png │ ├── homepage.png │ ├── login.png │ ├── pagelayout │ ├── layout.png │ └── toolbar.png │ ├── register-fr.png │ ├── register.png │ └── versioning │ └── layout.png ├── src ├── .htaccess └── Quickstart │ └── Bundle │ └── AppBundle │ ├── Controller │ ├── AccountController.php │ └── DefaultController.php │ ├── DataFixtures │ └── ORM │ │ └── LoadUserData.php │ ├── DependencyInjection │ ├── Configuration.php │ └── QuickstartAppExtension.php │ ├── Entity │ └── User.php │ ├── EventListener │ └── RegistrationListener.php │ ├── Features │ ├── Homepage │ │ └── homepage.feature │ ├── Registraton │ │ └── Register.feature │ ├── Security │ │ └── Login.feature │ ├── changelog.feature │ ├── homepage.feature │ ├── homepage.fr.feature │ ├── localisation.feature │ ├── navigation.feature │ └── navigation.fr.feature │ ├── Form │ └── RegistrationFormType.php │ ├── Menu │ └── MenuBuilder.php │ ├── QuickstartAppBundle.php │ ├── Resources │ ├── config │ │ ├── doctrine │ │ │ └── User.orm.yml │ │ ├── routing.yml │ │ ├── services.yml │ │ └── validation.yml │ ├── doc │ │ └── index.rst │ ├── translations │ │ ├── messages.en.yml │ │ └── messages.fr.yml │ └── views │ │ ├── Account │ │ └── index.html.twig │ │ └── Default │ │ ├── changelog.html.twig │ │ ├── index.html.twig │ │ └── knp_menu.html.twig │ ├── Service │ ├── RandomUsernameGenerator.php │ └── Version.php │ └── Tests │ ├── Controller │ ├── AccountControllerTest.php │ └── DefaultControllerTest.php │ └── Spec │ └── Quickstart │ └── Bundle │ └── AppBundle │ ├── DependencyInjection │ ├── ConfigurationSpec.php │ └── QuickstartAppExtensionSpec.php │ ├── EventListener │ └── RegistrationListenerSpec.php │ ├── Menu │ └── MenuBuilderSpec.php │ ├── QuickstartAppSpec.php │ └── Service │ ├── RandomUsernameGeneratorSpec.php │ └── VersionSpec.php ├── test ├── behat.yml ├── build │ └── .gitkeep ├── features │ └── bootstrap │ │ └── Quickstart │ │ └── Bundle │ │ └── AppBundle │ │ └── Features │ │ └── Context │ │ └── FeatureContext.php └── phpspec.yml ├── version └── web ├── .htaccess ├── app.php ├── app_dev.php ├── apple-touch-icon.png ├── config.php ├── favicon.ico └── robots.txt /.gitignore: -------------------------------------------------------------------------------- 1 | ._* 2 | .~lock.* 3 | .buildpath 4 | .DS_Store 5 | .idea 6 | .project 7 | 8 | composer.phar 9 | 10 | /web/bundles/ 11 | /app/bootstrap.php.cache 12 | /app/cache/* 13 | /app/config/parameters.yml 14 | /app/logs/* 15 | !app/cache/.gitkeep 16 | !app/logs/.gitkeep 17 | /build/ 18 | /vendor/ 19 | /bin/ 20 | !test/build/.gitkeep 21 | test/build/ 22 | web/fonts/ 23 | -------------------------------------------------------------------------------- /.make/dev: -------------------------------------------------------------------------------- 1 | dev.run: git.branch composer.install symfony.dev.rebuild symfony.server 2 | -------------------------------------------------------------------------------- /.make/symfony-test: -------------------------------------------------------------------------------- 1 | test.run: symfony.dev.rebuild symfony.test.bdd symfony.test.spec symfony.test.unit 2 | 3 | symfony.test.bdd: 4 | bin/behat --suite=quickstart_app --config=test/behat.yml --format=pretty 5 | 6 | symfony.test.spec: 7 | bin/phpspec run -vvv --format=pretty --config=test/phpspec.yml 8 | 9 | symfony.test.unit: 10 | bin/phpunit --configuration app 11 | -------------------------------------------------------------------------------- /.make/travisci-build: -------------------------------------------------------------------------------- 1 | build.package: build.user build.version build.changelog build.assets build.tag 2 | -------------------------------------------------------------------------------- /.scrutinizer.yml: -------------------------------------------------------------------------------- 1 | tools: 2 | external_code_coverage: 3 | timeout: 600 4 | php_sim: true 5 | php_pdepend: true 6 | php_analyzer: true 7 | checks: 8 | php: 9 | code_rating: true 10 | duplication: true 11 | 12 | filter: 13 | paths: [src/*] 14 | excluded_paths: [Tests/*, test/*, src/Quickstart/AppBundle/Tests/*] 15 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: php 2 | 3 | php: 4 | - 5.5 5 | 6 | before_script: 7 | - curl -s http://getcomposer.org/installer | php 8 | - php composer.phar install --dev --no-interaction 9 | - make symfony.dev.rebuild 10 | 11 | script: 12 | - make symfony.test.bdd suite=quickstart_app config=test/behat.yml 13 | - make symfony.test.unit suite=app 14 | - make symfony.test.spec config=test/phpspec.yml 15 | - make scrutinizer.coverage 16 | 17 | after_success: 18 | - make build.package 19 | 20 | after_failure: 21 | - make symfony.logs 22 | 23 | branches: 24 | except: 25 | - /^build-[0-9a-z\-\/]*/ 26 | 27 | env: 28 | global: 29 | - secure: XWoz6d9RvX6C3UGNNhPlMfdsg8p4J+5c6ZO6TB0sGIK8zVRSYwm3fTDLb+xIZKiBmp0eqgVmkiO9gPdkMtorfTUbEPYz2C2kXmR9gwtySQHqAcCPlNhDY1dloV9/3C3SKa58fvNRTkSRXR0bT/obVo0IUFLRyLnX4uLt2zhRHk4= 30 | 31 | deploy: 32 | provider: heroku 33 | api_key: 34 | secure: "AiIUUVKJ7sczcdqZKwjPQPutGCZqUXZTknKeVfO3hMpGPNxu+EmVL+iZkLjg3XK00zdNhgzvYE3ycugyyI++6+ScStfhBB5hj6d1o/FarYkGgX0O85AqIiFPKIi+No6uZwWbo1DpwQ0i4rOUn4GaFmW/LS/2NmMAwBSxEAVQh/g=" 35 | app: symfony-quickstart 36 | on: 37 | all_branches: true 38 | run: 39 | - "make symfony.dev.rebuild" 40 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributions 2 | 3 | Return to [Table of Contents](/README.md#table-of-contents) 4 | 5 | Please refer to standard [Contributing Documentation](https://github.com/TransformCore/documentation-templates/blob/master/contributions/Contributing.md) 6 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 EddieJaoude 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | LOCATION=./vendor/eddiejaoude/dev-helper-cmds 2 | GITHUBPROJECT=eddiejaoude/SymfonyQuickstart 3 | VERSIONFILE=version 4 | 5 | include $(LOCATION)/include.all 6 | include .make/* 7 | -------------------------------------------------------------------------------- /Procfile: -------------------------------------------------------------------------------- 1 | web: bin/heroku-php-apache2 web/ 2 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | [![DashboardHub Badge](http://badge.dashboardhub.io/badge/5506e7d1bdd384.83330390 "DashboardHub Badge")](http://pipeline.dashboardhub.io/d/5506e7d1bdd384.83330390) 2 | 3 | [![Join the chat at https://gitter.im/eddiejaoude/SymfonyQuickStart](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/eddiejaoude/SymfonyQuickStart?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) 4 | 5 | | --------- | master | develop | feature | 6 | | --------- | ------ | ------- | ------- | 7 | | Build | [![Build Status](https://travis-ci.org/eddiejaoude/SymfonyQuickStart.svg?branch=master)](https://travis-ci.org/eddiejaoude/SymfonyQuickStart) | --- | --- | 8 | | Coverage | [![Code Coverage](https://scrutinizer-ci.com/g/eddiejaoude/SymfonyQuickStart/badges/coverage.png?b=master)](https://scrutinizer-ci.com/g/eddiejaoude/SymfonyQuickStart/?branch=master) | --- | --- | 9 | | Analysis | [![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/eddiejaoude/SymfonyQuickStart/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/eddiejaoude/SymfonyQuickStart/?branch=master) | --- | --- | 10 | | json deps | [![Dependency Status](https://www.versioneye.com/user/projects/54bbab25879d51e9aa00021c/badge.svg?style=flat)](https://www.versioneye.com/user/projects/54bbab25879d51e9aa00021c) | --- | --- | 11 | | lock deps | [![Dependency Status](https://www.versioneye.com/user/projects/54bbab35879d51106e0001ea/badge.svg?style=flat)](https://www.versioneye.com/user/projects/54bbab35879d51106e0001ea) | --- | --- | 12 | 13 | # Symfony QuickStart 14 | 15 | Latest deploy (inc. branches) https://symfony-quickstart.herokuapp.com/en/ 16 | 17 | **Note: if you get an error, wait a minute & try again (refresh the page), the Application is probably deploying out or has gone to sleep.** 18 | 19 | ## Table of Contents 20 | 21 | * [Contribution guidelines](/CONTRIBUTING.md) 22 | * [Definition of Done](/doc/DefinitionOfDone.md) 23 | * [Versioning successful builds - Release Candidates](/doc/Versioning.md) 24 | * [Localisation](/doc/Localisation.md) 25 | * [PageLayout](/doc/PageLayout.md) 26 | * [Registration](/doc/Registration.md) 27 | 28 | 29 | ## Screenshots 30 | 31 | ![homepage](/doc/assets/homepage.png "Homepage") 32 | --- 33 | ![login](/doc/assets/login.png "Login") 34 | --- 35 | ![register](/doc/assets/register.png "Register") 36 | --- 37 | ![register-fr](/doc/assets/register-fr.png "Register French") 38 | 39 | ## Setup 40 | 41 | 1. Install dependencies 42 | 43 | ``` 44 | php composer.phar install 45 | ``` 46 | 47 | 2. Update parameters 48 | 49 | ``` 50 | /app/config/parameters_dev.yml 51 | ``` 52 | 53 | Database parameters are important: host, username, password etc... 54 | 55 | ## Run app 56 | 57 | 1. `make dev.run` 58 | 59 | Optionally add a **branch / release tag** `make dev.run branch=feature/story-123` 60 | 61 | This will run the following: 62 | * Switch to **branch / release** tag if requested 63 | * Install any/all dependencies (composer install) 64 | * Rebuild the database with fixtures 65 | * Start WebServer 66 | 67 | 2. Then go to `http://localhost:8000` 68 | 69 | ## Run full test suite in parallel 70 | 71 | ``` 72 | make test.run 73 | ``` 74 | 75 | Output 76 | 77 | ``` 78 | ... 79 | 30 scenarios (30 passed) 80 | 206 steps (206 passed) 81 | 0m13.12s (48.85Mb) 82 | ... 83 | 6 specs 84 | 16 examples (16 passed) 85 | 1132ms 86 | 87 | Generating code coverage report in html format ... 88 | Generating code coverage report in clover format ... 89 | ... 90 | OK (4 tests, 3 assertions) 91 | ``` 92 | 93 | 94 | This Rebuild the database & will run the commands below. 95 | 96 | ### Behat command (using config in test/behat.yml) 97 | 98 | ``` 99 | make symfony.test.bdd 100 | ``` 101 | 102 | ### PHPSpec 103 | 104 | ``` 105 | make symfony.test.spec 106 | ``` 107 | 108 | ### PHPUnit 109 | 110 | ``` 111 | make symfony.test.unit 112 | ``` 113 | 114 | ## Rebuild database 115 | 116 | [Reference](https://github.com/eddiejaoude/dev-helper-cmds#database) 117 | 118 | ``` 119 | make symfony.dev.rebuild 120 | ``` 121 | 122 | --- 123 | 124 | These commands are only **wrappers**, you can still use the original commands if you wish. 125 | 126 | More information on commands available visit [Make CMDs lib](https://github.com/eddiejaoude/dev-helper-cmds#built-in-commands) 127 | 128 | 129 | --- 130 | --- 131 | 132 | ## Contributions 133 | 134 | Please read on [Contribution Guildlines](/CONTRIBUTING.md) 135 | 136 | 137 | [![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/eddiejaoude/symfonyquickstart/trend.png)](https://bitdeli.com/free "Bitdeli Badge") 138 | 139 | -------------------------------------------------------------------------------- /app/.htaccess: -------------------------------------------------------------------------------- 1 | 2 | Require all denied 3 | 4 | 5 | Order deny,allow 6 | Deny from all 7 | 8 | -------------------------------------------------------------------------------- /app/AppCache.php: -------------------------------------------------------------------------------- 1 | getEnvironment(), array('dev', 'test'))) { 29 | $bundles[] = new Symfony\Bundle\WebProfilerBundle\WebProfilerBundle(); 30 | $bundles[] = new Sensio\Bundle\DistributionBundle\SensioDistributionBundle(); 31 | $bundles[] = new Sensio\Bundle\GeneratorBundle\SensioGeneratorBundle(); 32 | } 33 | 34 | return $bundles; 35 | } 36 | 37 | public function registerContainerConfiguration(LoaderInterface $loader) 38 | { 39 | $loader->load(__DIR__.'/config/config_'.$this->getEnvironment().'.yml'); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /app/Resources/FOSUserBundle/views/Registration/register.html.twig: -------------------------------------------------------------------------------- 1 | {% extends "::base.html.twig" %} 2 | 3 | {% block body %} 4 | 5 |

{% trans %}register.title{% endtrans %}

6 |

{% trans %}register.subtitle{% endtrans %}

7 | 8 | {% block fos_user_content %} 9 | {% include "FOSUserBundle:Registration:register_content.html.twig" %} 10 | {% endblock fos_user_content %} 11 | 12 | {% endblock body %} 13 | -------------------------------------------------------------------------------- /app/Resources/FOSUserBundle/views/Registration/register_content.html.twig: -------------------------------------------------------------------------------- 1 |
2 | 3 | {{ form_start(form) }} 4 | {{ form_errors(form) }} 5 | 6 | {{ form_row(form.firstname) }} 7 | {{ form_row(form.lastname) }} 8 | {{ form_row(form.email) }} 9 | {{ form_row(form.plainPassword.first) }} 10 | {{ form_row(form.plainPassword.second) }} 11 | 12 | {{ form_row(form.registerButton) }} 13 | 14 | {{ form_end(form) }} 15 | 16 |
17 | -------------------------------------------------------------------------------- /app/Resources/FOSUserBundle/views/Security/login.html.twig: -------------------------------------------------------------------------------- 1 | {% extends "::base.html.twig" %} 2 | 3 | {% block body %} 4 | 5 | {% block fos_user_content %} 6 | {% if error %} 7 | 10 | {% endif %} 11 | 12 |
13 | 14 | 15 |
16 | 17 | 19 |
20 |
21 | 22 | 24 |
25 | 26 | 28 |
29 | {% endblock fos_user_content %} 30 | 31 | {% endblock body %} 32 | -------------------------------------------------------------------------------- /app/Resources/FOSUserBundle/views/layout.html.twig: -------------------------------------------------------------------------------- 1 | {% extends "::base.html.twig" %} 2 | 3 | {% block body %} 4 | 5 |
6 | {% block fos_user_content %} 7 | {% endblock fos_user_content %} 8 |
9 | 10 | {% endblock body %} 11 | -------------------------------------------------------------------------------- /app/Resources/views/base.html.twig: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | {% block title %}Welcome!{% endblock title %} 6 | {% block stylesheets %}{% endblock stylesheets %} 7 | 8 | 9 | 10 | 11 | 12 | {% include 'BraincraftedBootstrapBundle::ie8-support.html.twig' %} 13 | 14 | 15 | 39 |
40 | {% block breadcrumb %}{% endblock breadcrumb %} 41 | 42 | {% for type, messages in app.session.flashbag.all() %} 43 | {% for message in messages %} 44 |
45 | {{ message }} 46 |
47 | {% endfor %} 48 | {% endfor %} 49 | 50 | {% block body %}{% endblock body %} 51 | {% block javascripts %}{% endblock javascripts %} 52 |
53 | 54 | 55 | -------------------------------------------------------------------------------- /app/SymfonyRequirements.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | /* 13 | * Users of PHP 5.2 should be able to run the requirements checks. 14 | * This is why the file and all classes must be compatible with PHP 5.2+ 15 | * (e.g. not using namespaces and closures). 16 | * 17 | * ************** CAUTION ************** 18 | * 19 | * DO NOT EDIT THIS FILE as it will be overridden by Composer as part of 20 | * the installation/update process. The original file resides in the 21 | * SensioDistributionBundle. 22 | * 23 | * ************** CAUTION ************** 24 | */ 25 | 26 | /** 27 | * Represents a single PHP requirement, e.g. an installed extension. 28 | * It can be a mandatory requirement or an optional recommendation. 29 | * There is a special subclass, named PhpIniRequirement, to check a php.ini configuration. 30 | * 31 | * @author Tobias Schultze 32 | */ 33 | class Requirement 34 | { 35 | private $fulfilled; 36 | private $testMessage; 37 | private $helpText; 38 | private $helpHtml; 39 | private $optional; 40 | 41 | /** 42 | * Constructor that initializes the requirement. 43 | * 44 | * @param bool $fulfilled Whether the requirement is fulfilled 45 | * @param string $testMessage The message for testing the requirement 46 | * @param string $helpHtml The help text formatted in HTML for resolving the problem 47 | * @param string|null $helpText The help text (when null, it will be inferred from $helpHtml, i.e. stripped from HTML tags) 48 | * @param bool $optional Whether this is only an optional recommendation not a mandatory requirement 49 | */ 50 | public function __construct($fulfilled, $testMessage, $helpHtml, $helpText = null, $optional = false) 51 | { 52 | $this->fulfilled = (bool) $fulfilled; 53 | $this->testMessage = (string) $testMessage; 54 | $this->helpHtml = (string) $helpHtml; 55 | $this->helpText = null === $helpText ? strip_tags($this->helpHtml) : (string) $helpText; 56 | $this->optional = (bool) $optional; 57 | } 58 | 59 | /** 60 | * Returns whether the requirement is fulfilled. 61 | * 62 | * @return bool true if fulfilled, otherwise false 63 | */ 64 | public function isFulfilled() 65 | { 66 | return $this->fulfilled; 67 | } 68 | 69 | /** 70 | * Returns the message for testing the requirement. 71 | * 72 | * @return string The test message 73 | */ 74 | public function getTestMessage() 75 | { 76 | return $this->testMessage; 77 | } 78 | 79 | /** 80 | * Returns the help text for resolving the problem 81 | * 82 | * @return string The help text 83 | */ 84 | public function getHelpText() 85 | { 86 | return $this->helpText; 87 | } 88 | 89 | /** 90 | * Returns the help text formatted in HTML. 91 | * 92 | * @return string The HTML help 93 | */ 94 | public function getHelpHtml() 95 | { 96 | return $this->helpHtml; 97 | } 98 | 99 | /** 100 | * Returns whether this is only an optional recommendation and not a mandatory requirement. 101 | * 102 | * @return bool true if optional, false if mandatory 103 | */ 104 | public function isOptional() 105 | { 106 | return $this->optional; 107 | } 108 | } 109 | 110 | /** 111 | * Represents a PHP requirement in form of a php.ini configuration. 112 | * 113 | * @author Tobias Schultze 114 | */ 115 | class PhpIniRequirement extends Requirement 116 | { 117 | /** 118 | * Constructor that initializes the requirement. 119 | * 120 | * @param string $cfgName The configuration name used for ini_get() 121 | * @param bool|callback $evaluation Either a boolean indicating whether the configuration should evaluate to true or false, 122 | or a callback function receiving the configuration value as parameter to determine the fulfillment of the requirement 123 | * @param bool $approveCfgAbsence If true the Requirement will be fulfilled even if the configuration option does not exist, i.e. ini_get() returns false. 124 | This is helpful for abandoned configs in later PHP versions or configs of an optional extension, like Suhosin. 125 | Example: You require a config to be true but PHP later removes this config and defaults it to true internally. 126 | * @param string|null $testMessage The message for testing the requirement (when null and $evaluation is a boolean a default message is derived) 127 | * @param string|null $helpHtml The help text formatted in HTML for resolving the problem (when null and $evaluation is a boolean a default help is derived) 128 | * @param string|null $helpText The help text (when null, it will be inferred from $helpHtml, i.e. stripped from HTML tags) 129 | * @param bool $optional Whether this is only an optional recommendation not a mandatory requirement 130 | */ 131 | public function __construct($cfgName, $evaluation, $approveCfgAbsence = false, $testMessage = null, $helpHtml = null, $helpText = null, $optional = false) 132 | { 133 | $cfgValue = ini_get($cfgName); 134 | 135 | if (is_callable($evaluation)) { 136 | if (null === $testMessage || null === $helpHtml) { 137 | throw new InvalidArgumentException('You must provide the parameters testMessage and helpHtml for a callback evaluation.'); 138 | } 139 | 140 | $fulfilled = call_user_func($evaluation, $cfgValue); 141 | } else { 142 | if (null === $testMessage) { 143 | $testMessage = sprintf('%s %s be %s in php.ini', 144 | $cfgName, 145 | $optional ? 'should' : 'must', 146 | $evaluation ? 'enabled' : 'disabled' 147 | ); 148 | } 149 | 150 | if (null === $helpHtml) { 151 | $helpHtml = sprintf('Set %s to %s in php.ini*.', 152 | $cfgName, 153 | $evaluation ? 'on' : 'off' 154 | ); 155 | } 156 | 157 | $fulfilled = $evaluation == $cfgValue; 158 | } 159 | 160 | parent::__construct($fulfilled || ($approveCfgAbsence && false === $cfgValue), $testMessage, $helpHtml, $helpText, $optional); 161 | } 162 | } 163 | 164 | /** 165 | * A RequirementCollection represents a set of Requirement instances. 166 | * 167 | * @author Tobias Schultze 168 | */ 169 | class RequirementCollection implements IteratorAggregate 170 | { 171 | private $requirements = array(); 172 | 173 | /** 174 | * Gets the current RequirementCollection as an Iterator. 175 | * 176 | * @return Traversable A Traversable interface 177 | */ 178 | public function getIterator() 179 | { 180 | return new ArrayIterator($this->requirements); 181 | } 182 | 183 | /** 184 | * Adds a Requirement. 185 | * 186 | * @param Requirement $requirement A Requirement instance 187 | */ 188 | public function add(Requirement $requirement) 189 | { 190 | $this->requirements[] = $requirement; 191 | } 192 | 193 | /** 194 | * Adds a mandatory requirement. 195 | * 196 | * @param bool $fulfilled Whether the requirement is fulfilled 197 | * @param string $testMessage The message for testing the requirement 198 | * @param string $helpHtml The help text formatted in HTML for resolving the problem 199 | * @param string|null $helpText The help text (when null, it will be inferred from $helpHtml, i.e. stripped from HTML tags) 200 | */ 201 | public function addRequirement($fulfilled, $testMessage, $helpHtml, $helpText = null) 202 | { 203 | $this->add(new Requirement($fulfilled, $testMessage, $helpHtml, $helpText, false)); 204 | } 205 | 206 | /** 207 | * Adds an optional recommendation. 208 | * 209 | * @param bool $fulfilled Whether the recommendation is fulfilled 210 | * @param string $testMessage The message for testing the recommendation 211 | * @param string $helpHtml The help text formatted in HTML for resolving the problem 212 | * @param string|null $helpText The help text (when null, it will be inferred from $helpHtml, i.e. stripped from HTML tags) 213 | */ 214 | public function addRecommendation($fulfilled, $testMessage, $helpHtml, $helpText = null) 215 | { 216 | $this->add(new Requirement($fulfilled, $testMessage, $helpHtml, $helpText, true)); 217 | } 218 | 219 | /** 220 | * Adds a mandatory requirement in form of a php.ini configuration. 221 | * 222 | * @param string $cfgName The configuration name used for ini_get() 223 | * @param bool|callback $evaluation Either a boolean indicating whether the configuration should evaluate to true or false, 224 | or a callback function receiving the configuration value as parameter to determine the fulfillment of the requirement 225 | * @param bool $approveCfgAbsence If true the Requirement will be fulfilled even if the configuration option does not exist, i.e. ini_get() returns false. 226 | This is helpful for abandoned configs in later PHP versions or configs of an optional extension, like Suhosin. 227 | Example: You require a config to be true but PHP later removes this config and defaults it to true internally. 228 | * @param string $testMessage The message for testing the requirement (when null and $evaluation is a boolean a default message is derived) 229 | * @param string $helpHtml The help text formatted in HTML for resolving the problem (when null and $evaluation is a boolean a default help is derived) 230 | * @param string|null $helpText The help text (when null, it will be inferred from $helpHtml, i.e. stripped from HTML tags) 231 | */ 232 | public function addPhpIniRequirement($cfgName, $evaluation, $approveCfgAbsence = false, $testMessage = null, $helpHtml = null, $helpText = null) 233 | { 234 | $this->add(new PhpIniRequirement($cfgName, $evaluation, $approveCfgAbsence, $testMessage, $helpHtml, $helpText, false)); 235 | } 236 | 237 | /** 238 | * Adds an optional recommendation in form of a php.ini configuration. 239 | * 240 | * @param string $cfgName The configuration name used for ini_get() 241 | * @param bool|callback $evaluation Either a boolean indicating whether the configuration should evaluate to true or false, 242 | or a callback function receiving the configuration value as parameter to determine the fulfillment of the requirement 243 | * @param bool $approveCfgAbsence If true the Requirement will be fulfilled even if the configuration option does not exist, i.e. ini_get() returns false. 244 | This is helpful for abandoned configs in later PHP versions or configs of an optional extension, like Suhosin. 245 | Example: You require a config to be true but PHP later removes this config and defaults it to true internally. 246 | * @param string $testMessage The message for testing the requirement (when null and $evaluation is a boolean a default message is derived) 247 | * @param string $helpHtml The help text formatted in HTML for resolving the problem (when null and $evaluation is a boolean a default help is derived) 248 | * @param string|null $helpText The help text (when null, it will be inferred from $helpHtml, i.e. stripped from HTML tags) 249 | */ 250 | public function addPhpIniRecommendation($cfgName, $evaluation, $approveCfgAbsence = false, $testMessage = null, $helpHtml = null, $helpText = null) 251 | { 252 | $this->add(new PhpIniRequirement($cfgName, $evaluation, $approveCfgAbsence, $testMessage, $helpHtml, $helpText, true)); 253 | } 254 | 255 | /** 256 | * Adds a requirement collection to the current set of requirements. 257 | * 258 | * @param RequirementCollection $collection A RequirementCollection instance 259 | */ 260 | public function addCollection(RequirementCollection $collection) 261 | { 262 | $this->requirements = array_merge($this->requirements, $collection->all()); 263 | } 264 | 265 | /** 266 | * Returns both requirements and recommendations. 267 | * 268 | * @return array Array of Requirement instances 269 | */ 270 | public function all() 271 | { 272 | return $this->requirements; 273 | } 274 | 275 | /** 276 | * Returns all mandatory requirements. 277 | * 278 | * @return array Array of Requirement instances 279 | */ 280 | public function getRequirements() 281 | { 282 | $array = array(); 283 | foreach ($this->requirements as $req) { 284 | if (!$req->isOptional()) { 285 | $array[] = $req; 286 | } 287 | } 288 | 289 | return $array; 290 | } 291 | 292 | /** 293 | * Returns the mandatory requirements that were not met. 294 | * 295 | * @return array Array of Requirement instances 296 | */ 297 | public function getFailedRequirements() 298 | { 299 | $array = array(); 300 | foreach ($this->requirements as $req) { 301 | if (!$req->isFulfilled() && !$req->isOptional()) { 302 | $array[] = $req; 303 | } 304 | } 305 | 306 | return $array; 307 | } 308 | 309 | /** 310 | * Returns all optional recommendations. 311 | * 312 | * @return array Array of Requirement instances 313 | */ 314 | public function getRecommendations() 315 | { 316 | $array = array(); 317 | foreach ($this->requirements as $req) { 318 | if ($req->isOptional()) { 319 | $array[] = $req; 320 | } 321 | } 322 | 323 | return $array; 324 | } 325 | 326 | /** 327 | * Returns the recommendations that were not met. 328 | * 329 | * @return array Array of Requirement instances 330 | */ 331 | public function getFailedRecommendations() 332 | { 333 | $array = array(); 334 | foreach ($this->requirements as $req) { 335 | if (!$req->isFulfilled() && $req->isOptional()) { 336 | $array[] = $req; 337 | } 338 | } 339 | 340 | return $array; 341 | } 342 | 343 | /** 344 | * Returns whether a php.ini configuration is not correct. 345 | * 346 | * @return bool php.ini configuration problem? 347 | */ 348 | public function hasPhpIniConfigIssue() 349 | { 350 | foreach ($this->requirements as $req) { 351 | if (!$req->isFulfilled() && $req instanceof PhpIniRequirement) { 352 | return true; 353 | } 354 | } 355 | 356 | return false; 357 | } 358 | 359 | /** 360 | * Returns the PHP configuration file (php.ini) path. 361 | * 362 | * @return string|false php.ini file path 363 | */ 364 | public function getPhpIniConfigPath() 365 | { 366 | return get_cfg_var('cfg_file_path'); 367 | } 368 | } 369 | 370 | /** 371 | * This class specifies all requirements and optional recommendations that 372 | * are necessary to run the Symfony Standard Edition. 373 | * 374 | * @author Tobias Schultze 375 | * @author Fabien Potencier 376 | */ 377 | class SymfonyRequirements extends RequirementCollection 378 | { 379 | const REQUIRED_PHP_VERSION = '5.3.3'; 380 | 381 | /** 382 | * Constructor that initializes the requirements. 383 | */ 384 | public function __construct() 385 | { 386 | /* mandatory requirements follow */ 387 | 388 | $installedPhpVersion = phpversion(); 389 | 390 | $this->addRequirement( 391 | version_compare($installedPhpVersion, self::REQUIRED_PHP_VERSION, '>='), 392 | sprintf('PHP version must be at least %s (%s installed)', self::REQUIRED_PHP_VERSION, $installedPhpVersion), 393 | sprintf('You are running PHP version "%s", but Symfony needs at least PHP "%s" to run. 394 | Before using Symfony, upgrade your PHP installation, preferably to the latest version.', 395 | $installedPhpVersion, self::REQUIRED_PHP_VERSION), 396 | sprintf('Install PHP %s or newer (installed version is %s)', self::REQUIRED_PHP_VERSION, $installedPhpVersion) 397 | ); 398 | 399 | $this->addRequirement( 400 | version_compare($installedPhpVersion, '5.3.16', '!='), 401 | 'PHP version must not be 5.3.16 as Symfony won\'t work properly with it', 402 | 'Install PHP 5.3.17 or newer (or downgrade to an earlier PHP version)' 403 | ); 404 | 405 | $this->addRequirement( 406 | is_dir(__DIR__.'/../vendor/composer'), 407 | 'Vendor libraries must be installed', 408 | 'Vendor libraries are missing. Install composer following instructions from http://getcomposer.org/. '. 409 | 'Then run "php composer.phar install" to install them.' 410 | ); 411 | 412 | $cacheDir = is_dir(__DIR__.'/../var/cache') ? __DIR__.'/../var/cache' : __DIR__.'/cache'; 413 | 414 | $this->addRequirement( 415 | is_writable($cacheDir), 416 | 'app/cache/ or var/cache/ directory must be writable', 417 | 'Change the permissions of either "app/cache/" or "var/cache/" directory so that the web server can write into it.' 418 | ); 419 | 420 | $logsDir = is_dir(__DIR__.'/../var/logs') ? __DIR__.'/../var/logs' : __DIR__.'/logs'; 421 | 422 | $this->addRequirement( 423 | is_writable($logsDir), 424 | 'app/logs/ or var/logs/ directory must be writable', 425 | 'Change the permissions of either "app/logs/" or "var/logs/" directory so that the web server can write into it.' 426 | ); 427 | 428 | $this->addPhpIniRequirement( 429 | 'date.timezone', true, false, 430 | 'date.timezone setting must be set', 431 | 'Set the "date.timezone" setting in php.ini* (like Europe/Paris).' 432 | ); 433 | 434 | if (version_compare($installedPhpVersion, self::REQUIRED_PHP_VERSION, '>=')) { 435 | $timezones = array(); 436 | foreach (DateTimeZone::listAbbreviations() as $abbreviations) { 437 | foreach ($abbreviations as $abbreviation) { 438 | $timezones[$abbreviation['timezone_id']] = true; 439 | } 440 | } 441 | 442 | $this->addRequirement( 443 | isset($timezones[@date_default_timezone_get()]), 444 | sprintf('Configured default timezone "%s" must be supported by your installation of PHP', @date_default_timezone_get()), 445 | 'Your default timezone is not supported by PHP. Check for typos in your php.ini file and have a look at the list of deprecated timezones at http://php.net/manual/en/timezones.others.php.' 446 | ); 447 | } 448 | 449 | $this->addRequirement( 450 | function_exists('json_encode'), 451 | 'json_encode() must be available', 452 | 'Install and enable the JSON extension.' 453 | ); 454 | 455 | $this->addRequirement( 456 | function_exists('session_start'), 457 | 'session_start() must be available', 458 | 'Install and enable the session extension.' 459 | ); 460 | 461 | $this->addRequirement( 462 | function_exists('ctype_alpha'), 463 | 'ctype_alpha() must be available', 464 | 'Install and enable the ctype extension.' 465 | ); 466 | 467 | $this->addRequirement( 468 | function_exists('token_get_all'), 469 | 'token_get_all() must be available', 470 | 'Install and enable the Tokenizer extension.' 471 | ); 472 | 473 | $this->addRequirement( 474 | function_exists('simplexml_import_dom'), 475 | 'simplexml_import_dom() must be available', 476 | 'Install and enable the SimpleXML extension.' 477 | ); 478 | 479 | if (function_exists('apc_store') && ini_get('apc.enabled')) { 480 | if (version_compare($installedPhpVersion, '5.4.0', '>=')) { 481 | $this->addRequirement( 482 | version_compare(phpversion('apc'), '3.1.13', '>='), 483 | 'APC version must be at least 3.1.13 when using PHP 5.4', 484 | 'Upgrade your APC extension (3.1.13+).' 485 | ); 486 | } else { 487 | $this->addRequirement( 488 | version_compare(phpversion('apc'), '3.0.17', '>='), 489 | 'APC version must be at least 3.0.17', 490 | 'Upgrade your APC extension (3.0.17+).' 491 | ); 492 | } 493 | } 494 | 495 | $this->addPhpIniRequirement('detect_unicode', false); 496 | 497 | if (extension_loaded('suhosin')) { 498 | $this->addPhpIniRequirement( 499 | 'suhosin.executor.include.whitelist', 500 | create_function('$cfgValue', 'return false !== stripos($cfgValue, "phar");'), 501 | false, 502 | 'suhosin.executor.include.whitelist must be configured correctly in php.ini', 503 | 'Add "phar" to suhosin.executor.include.whitelist in php.ini*.' 504 | ); 505 | } 506 | 507 | if (extension_loaded('xdebug')) { 508 | $this->addPhpIniRequirement( 509 | 'xdebug.show_exception_trace', false, true 510 | ); 511 | 512 | $this->addPhpIniRequirement( 513 | 'xdebug.scream', false, true 514 | ); 515 | 516 | $this->addPhpIniRecommendation( 517 | 'xdebug.max_nesting_level', 518 | create_function('$cfgValue', 'return $cfgValue > 100;'), 519 | true, 520 | 'xdebug.max_nesting_level should be above 100 in php.ini', 521 | 'Set "xdebug.max_nesting_level" to e.g. "250" in php.ini* to stop Xdebug\'s infinite recursion protection erroneously throwing a fatal error in your project.' 522 | ); 523 | } 524 | 525 | $pcreVersion = defined('PCRE_VERSION') ? (float) PCRE_VERSION : null; 526 | 527 | $this->addRequirement( 528 | null !== $pcreVersion, 529 | 'PCRE extension must be available', 530 | 'Install the PCRE extension (version 8.0+).' 531 | ); 532 | 533 | if (extension_loaded('mbstring')) { 534 | $this->addPhpIniRequirement( 535 | 'mbstring.func_overload', 536 | create_function('$cfgValue', 'return (int) $cfgValue === 0;'), 537 | true, 538 | 'string functions should not be overloaded', 539 | 'Set "mbstring.func_overload" to 0 in php.ini* to disable function overloading by the mbstring extension.' 540 | ); 541 | } 542 | 543 | /* optional recommendations follow */ 544 | 545 | $this->addRecommendation( 546 | file_get_contents(__FILE__) === file_get_contents(__DIR__.'/../vendor/sensio/distribution-bundle/Sensio/Bundle/DistributionBundle/Resources/skeleton/app/SymfonyRequirements.php'), 547 | 'Requirements file should be up-to-date', 548 | 'Your requirements file is outdated. Run composer install and re-check your configuration.' 549 | ); 550 | 551 | $this->addRecommendation( 552 | version_compare($installedPhpVersion, '5.3.4', '>='), 553 | 'You should use at least PHP 5.3.4 due to PHP bug #52083 in earlier versions', 554 | 'Your project might malfunction randomly due to PHP bug #52083 ("Notice: Trying to get property of non-object"). Install PHP 5.3.4 or newer.' 555 | ); 556 | 557 | $this->addRecommendation( 558 | version_compare($installedPhpVersion, '5.3.8', '>='), 559 | 'When using annotations you should have at least PHP 5.3.8 due to PHP bug #55156', 560 | 'Install PHP 5.3.8 or newer if your project uses annotations.' 561 | ); 562 | 563 | $this->addRecommendation( 564 | version_compare($installedPhpVersion, '5.4.0', '!='), 565 | 'You should not use PHP 5.4.0 due to the PHP bug #61453', 566 | 'Your project might not work properly due to the PHP bug #61453 ("Cannot dump definitions which have method calls"). Install PHP 5.4.1 or newer.' 567 | ); 568 | 569 | $this->addRecommendation( 570 | version_compare($installedPhpVersion, '5.4.11', '>='), 571 | 'When using the logout handler from the Symfony Security Component, you should have at least PHP 5.4.11 due to PHP bug #63379 (as a workaround, you can also set invalidate_session to false in the security logout handler configuration)', 572 | 'Install PHP 5.4.11 or newer if your project uses the logout handler from the Symfony Security Component.' 573 | ); 574 | 575 | $this->addRecommendation( 576 | (version_compare($installedPhpVersion, '5.3.18', '>=') && version_compare($installedPhpVersion, '5.4.0', '<')) 577 | || 578 | version_compare($installedPhpVersion, '5.4.8', '>='), 579 | 'You should use PHP 5.3.18+ or PHP 5.4.8+ to always get nice error messages for fatal errors in the development environment due to PHP bug #61767/#60909', 580 | 'Install PHP 5.3.18+ or PHP 5.4.8+ if you want nice error messages for all fatal errors in the development environment.' 581 | ); 582 | 583 | if (null !== $pcreVersion) { 584 | $this->addRecommendation( 585 | $pcreVersion >= 8.0, 586 | sprintf('PCRE extension should be at least version 8.0 (%s installed)', $pcreVersion), 587 | 'PCRE 8.0+ is preconfigured in PHP since 5.3.2 but you are using an outdated version of it. Symfony probably works anyway but it is recommended to upgrade your PCRE extension.' 588 | ); 589 | } 590 | 591 | $this->addRecommendation( 592 | class_exists('DomDocument'), 593 | 'PHP-DOM and PHP-XML modules should be installed', 594 | 'Install and enable the PHP-DOM and the PHP-XML modules.' 595 | ); 596 | 597 | $this->addRecommendation( 598 | function_exists('mb_strlen'), 599 | 'mb_strlen() should be available', 600 | 'Install and enable the mbstring extension.' 601 | ); 602 | 603 | $this->addRecommendation( 604 | function_exists('iconv'), 605 | 'iconv() should be available', 606 | 'Install and enable the iconv extension.' 607 | ); 608 | 609 | $this->addRecommendation( 610 | function_exists('utf8_decode'), 611 | 'utf8_decode() should be available', 612 | 'Install and enable the XML extension.' 613 | ); 614 | 615 | $this->addRecommendation( 616 | function_exists('filter_var'), 617 | 'filter_var() should be available', 618 | 'Install and enable the filter extension.' 619 | ); 620 | 621 | if (!defined('PHP_WINDOWS_VERSION_BUILD')) { 622 | $this->addRecommendation( 623 | function_exists('posix_isatty'), 624 | 'posix_isatty() should be available', 625 | 'Install and enable the php_posix extension (used to colorize the CLI output).' 626 | ); 627 | } 628 | 629 | $this->addRecommendation( 630 | class_exists('Locale'), 631 | 'intl extension should be available', 632 | 'Install and enable the intl extension (used for validators).' 633 | ); 634 | 635 | if (class_exists('Collator')) { 636 | $this->addRecommendation( 637 | null !== new Collator('fr_FR'), 638 | 'intl extension should be correctly configured', 639 | 'The intl extension does not behave properly. This problem is typical on PHP 5.3.X x64 WIN builds.' 640 | ); 641 | } 642 | 643 | if (class_exists('Locale')) { 644 | if (defined('INTL_ICU_VERSION')) { 645 | $version = INTL_ICU_VERSION; 646 | } else { 647 | $reflector = new ReflectionExtension('intl'); 648 | 649 | ob_start(); 650 | $reflector->info(); 651 | $output = strip_tags(ob_get_clean()); 652 | 653 | preg_match('/^ICU version +(?:=> )?(.*)$/m', $output, $matches); 654 | $version = $matches[1]; 655 | } 656 | 657 | $this->addRecommendation( 658 | version_compare($version, '4.0', '>='), 659 | 'intl ICU version should be at least 4+', 660 | 'Upgrade your intl extension with a newer ICU version (4+).' 661 | ); 662 | } 663 | 664 | $accelerator = 665 | (extension_loaded('eaccelerator') && ini_get('eaccelerator.enable')) 666 | || 667 | (extension_loaded('apc') && ini_get('apc.enabled')) 668 | || 669 | (extension_loaded('Zend Optimizer+') && ini_get('zend_optimizerplus.enable')) 670 | || 671 | (extension_loaded('Zend OPcache') && ini_get('opcache.enable')) 672 | || 673 | (extension_loaded('xcache') && ini_get('xcache.cacher')) 674 | || 675 | (extension_loaded('wincache') && ini_get('wincache.ocenabled')) 676 | ; 677 | 678 | $this->addRecommendation( 679 | $accelerator, 680 | 'a PHP accelerator should be installed', 681 | 'Install and/or enable a PHP accelerator (highly recommended).' 682 | ); 683 | 684 | if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') { 685 | $this->addRecommendation( 686 | $this->getRealpathCacheSize() > 1000, 687 | 'realpath_cache_size should be above 1024 in php.ini', 688 | 'Set "realpath_cache_size" to e.g. "1024" in php.ini* to improve performance on windows.' 689 | ); 690 | } 691 | 692 | $this->addPhpIniRecommendation('short_open_tag', false); 693 | 694 | $this->addPhpIniRecommendation('magic_quotes_gpc', false, true); 695 | 696 | $this->addPhpIniRecommendation('register_globals', false, true); 697 | 698 | $this->addPhpIniRecommendation('session.auto_start', false); 699 | 700 | $this->addRecommendation( 701 | class_exists('PDO'), 702 | 'PDO should be installed', 703 | 'Install PDO (mandatory for Doctrine).' 704 | ); 705 | 706 | if (class_exists('PDO')) { 707 | $drivers = PDO::getAvailableDrivers(); 708 | $this->addRecommendation( 709 | count($drivers) > 0, 710 | sprintf('PDO should have some drivers installed (currently available: %s)', count($drivers) ? implode(', ', $drivers) : 'none'), 711 | 'Install PDO drivers (mandatory for Doctrine).' 712 | ); 713 | } 714 | } 715 | 716 | /** 717 | * Loads realpath_cache_size from php.ini and converts it to int. 718 | * 719 | * (e.g. 16k is converted to 16384 int) 720 | * 721 | * @return int 722 | */ 723 | protected function getRealpathCacheSize() 724 | { 725 | $size = ini_get('realpath_cache_size'); 726 | $size = trim($size); 727 | $unit = strtolower(substr($size, -1, 1)); 728 | switch ($unit) { 729 | case 'g': 730 | return $size * 1024 * 1024 * 1024; 731 | case 'm': 732 | return $size * 1024 * 1024; 733 | case 'k': 734 | return $size * 1024; 735 | default: 736 | return (int) $size; 737 | } 738 | } 739 | } 740 | -------------------------------------------------------------------------------- /app/autoload.php: -------------------------------------------------------------------------------- 1 | getPhpIniConfigPath(); 8 | 9 | echo_title('Symfony2 Requirements Checker'); 10 | 11 | echo '> PHP is using the following php.ini file:'.PHP_EOL; 12 | if ($iniPath) { 13 | echo_style('green', ' '.$iniPath); 14 | } else { 15 | echo_style('warning', ' WARNING: No configuration file (php.ini) used by PHP!'); 16 | } 17 | 18 | echo PHP_EOL.PHP_EOL; 19 | 20 | echo '> Checking Symfony requirements:'.PHP_EOL.' '; 21 | 22 | $messages = array(); 23 | foreach ($symfonyRequirements->getRequirements() as $req) { 24 | /** @var $req Requirement */ 25 | if ($helpText = get_error_message($req, $lineSize)) { 26 | echo_style('red', 'E'); 27 | $messages['error'][] = $helpText; 28 | } else { 29 | echo_style('green', '.'); 30 | } 31 | } 32 | 33 | $checkPassed = empty($messages['error']); 34 | 35 | foreach ($symfonyRequirements->getRecommendations() as $req) { 36 | if ($helpText = get_error_message($req, $lineSize)) { 37 | echo_style('yellow', 'W'); 38 | $messages['warning'][] = $helpText; 39 | } else { 40 | echo_style('green', '.'); 41 | } 42 | } 43 | 44 | if ($checkPassed) { 45 | echo_block('success', 'OK', 'Your system is ready to run Symfony2 projects', true); 46 | } else { 47 | echo_block('error', 'ERROR', 'Your system is not ready to run Symfony2 projects', true); 48 | 49 | echo_title('Fix the following mandatory requirements', 'red'); 50 | 51 | foreach ($messages['error'] as $helpText) { 52 | echo ' * '.$helpText.PHP_EOL; 53 | } 54 | } 55 | 56 | if (!empty($messages['warning'])) { 57 | echo_title('Optional recommendations to improve your setup', 'yellow'); 58 | 59 | foreach ($messages['warning'] as $helpText) { 60 | echo ' * '.$helpText.PHP_EOL; 61 | } 62 | } 63 | 64 | echo PHP_EOL; 65 | echo_style('title', 'Note'); 66 | echo ' The command console could use a different php.ini file'.PHP_EOL; 67 | echo_style('title', '~~~~'); 68 | echo ' than the one used with your web server. To be on the'.PHP_EOL; 69 | echo ' safe side, please check the requirements from your web'.PHP_EOL; 70 | echo ' server using the '; 71 | echo_style('yellow', 'web/config.php'); 72 | echo ' script.'.PHP_EOL; 73 | echo PHP_EOL; 74 | 75 | exit($checkPassed ? 0 : 1); 76 | 77 | function get_error_message(Requirement $requirement, $lineSize) 78 | { 79 | if ($requirement->isFulfilled()) { 80 | return; 81 | } 82 | 83 | $errorMessage = wordwrap($requirement->getTestMessage(), $lineSize - 3, PHP_EOL.' ').PHP_EOL; 84 | $errorMessage .= ' > '.wordwrap($requirement->getHelpText(), $lineSize - 5, PHP_EOL.' > ').PHP_EOL; 85 | 86 | return $errorMessage; 87 | } 88 | 89 | function echo_title($title, $style = null) 90 | { 91 | $style = $style ?: 'title'; 92 | 93 | echo PHP_EOL; 94 | echo_style($style, $title.PHP_EOL); 95 | echo_style($style, str_repeat('~', strlen($title)).PHP_EOL); 96 | echo PHP_EOL; 97 | } 98 | 99 | function echo_style($style, $message) 100 | { 101 | // ANSI color codes 102 | $styles = array( 103 | 'reset' => "\033[0m", 104 | 'red' => "\033[31m", 105 | 'green' => "\033[32m", 106 | 'yellow' => "\033[33m", 107 | 'error' => "\033[37;41m", 108 | 'success' => "\033[37;42m", 109 | 'title' => "\033[34m", 110 | ); 111 | $supports = has_color_support(); 112 | 113 | echo($supports ? $styles[$style] : '').$message.($supports ? $styles['reset'] : ''); 114 | } 115 | 116 | function echo_block($style, $title, $message) 117 | { 118 | $message = ' '.trim($message).' '; 119 | $width = strlen($message); 120 | 121 | echo PHP_EOL.PHP_EOL; 122 | 123 | echo_style($style, str_repeat(' ', $width).PHP_EOL); 124 | echo_style($style, str_pad(' ['.$title.']', $width, ' ', STR_PAD_RIGHT).PHP_EOL); 125 | echo_style($style, str_pad($message, $width, ' ', STR_PAD_RIGHT).PHP_EOL); 126 | echo_style($style, str_repeat(' ', $width).PHP_EOL); 127 | } 128 | 129 | function has_color_support() 130 | { 131 | static $support; 132 | 133 | if (null === $support) { 134 | if (DIRECTORY_SEPARATOR == '\\') { 135 | $support = false !== getenv('ANSICON') || 'ON' === getenv('ConEmuANSI'); 136 | } else { 137 | $support = function_exists('posix_isatty') && @posix_isatty(STDOUT); 138 | } 139 | } 140 | 141 | return $support; 142 | } 143 | -------------------------------------------------------------------------------- /app/config/config.yml: -------------------------------------------------------------------------------- 1 | imports: 2 | - { resource: parameters.yml } 3 | - { resource: security.yml } 4 | 5 | framework: 6 | #esi: ~ 7 | translator: { fallback: "%locale%" } 8 | secret: "%secret%" 9 | router: 10 | resource: "%kernel.root_dir%/config/routing.yml" 11 | strict_requirements: ~ 12 | form: ~ 13 | csrf_protection: ~ 14 | validation: { enable_annotations: true } 15 | templating: 16 | engines: ['twig'] 17 | #assets_version: SomeVersionScheme 18 | default_locale: "%locale%" 19 | trusted_hosts: ~ 20 | trusted_proxies: ~ 21 | session: 22 | # handler_id set to null will use default session handler from php.ini 23 | handler_id: ~ 24 | fragments: ~ 25 | http_method_override: true 26 | 27 | # Twig Configuration 28 | twig: 29 | debug: "%kernel.debug%" 30 | strict_variables: "%kernel.debug%" 31 | globals: 32 | version: "@quickstart_app_main.service.version" 33 | 34 | # Assetic Configuration 35 | assetic: 36 | debug: "%kernel.debug%" 37 | use_controller: false 38 | bundles: [ ] 39 | #java: /usr/bin/java 40 | filters: 41 | cssrewrite: ~ 42 | #closure: 43 | # jar: "%kernel.root_dir%/Resources/java/compiler.jar" 44 | #yui_css: 45 | # jar: "%kernel.root_dir%/Resources/java/yuicompressor-2.4.7.jar" 46 | 47 | # Doctrine Configuration 48 | doctrine: 49 | dbal: 50 | driver: "%database_driver%" 51 | host: "%database_host%" 52 | port: "%database_port%" 53 | dbname: "%database_name%" 54 | user: "%database_user%" 55 | password: "%database_password%" 56 | charset: UTF8 57 | # if using pdo_sqlite as your database driver: 58 | # 1. add the path in parameters.yml 59 | # e.g. database_path: "%kernel.root_dir%/data/data.db3" 60 | # 2. Uncomment database_path in parameters.yml.dist 61 | # 3. Uncomment next line: 62 | # path: "%database_path%" 63 | 64 | orm: 65 | auto_generate_proxy_classes: "%kernel.debug%" 66 | auto_mapping: true 67 | 68 | swiftmailer: 69 | transport: "%mailer_transport%" 70 | host: "%mailer_host%" 71 | username: "%mailer_user%" 72 | password: "%mailer_password%" 73 | spool: { type: memory } 74 | 75 | braincrafted_bootstrap: 76 | # output_dir: 77 | # assets_dir: %kernel.root_dir%/../vendor/twbs/bootstrap 78 | # jquery_path: %kernel.root_dir%/../vendor/jquery/jquery/jquery-1.11.1.js 79 | less_filter: none # "less", "lessphp", "sass" or "none" 80 | fonts_dir: %kernel.root_dir%/../web/fonts 81 | auto_configure: 82 | assetic: true 83 | twig: true 84 | knp_menu: true 85 | knp_paginator: true 86 | customize: 87 | variables_file: ~ 88 | bootstrap_output: %kernel.root_dir%/Resources/less/bootstrap.less 89 | bootstrap_template: BraincraftedBootstrapBundle:Bootstrap:bootstrap.less.twig 90 | 91 | jms_i18n_routing: 92 | default_locale: en 93 | locales: [en, fr] 94 | strategy: prefix 95 | 96 | fos_user: 97 | db_driver: orm 98 | firewall_name: main 99 | user_class: Quickstart\Bundle\AppBundle\Entity\User 100 | use_username_form_type: false 101 | registration: 102 | form: 103 | type: quickstart_user_registration 104 | validation_groups: [QuickstartRegistration] 105 | -------------------------------------------------------------------------------- /app/config/config_dev.yml: -------------------------------------------------------------------------------- 1 | imports: 2 | - { resource: config.yml } 3 | - { resource: parameters_dev.yml } 4 | 5 | framework: 6 | router: 7 | resource: "%kernel.root_dir%/config/routing_dev.yml" 8 | strict_requirements: true 9 | profiler: { only_exceptions: false } 10 | 11 | web_profiler: 12 | toolbar: "%debug_toolbar%" 13 | intercept_redirects: "%debug_redirects%" 14 | 15 | monolog: 16 | handlers: 17 | main: 18 | type: stream 19 | path: "%kernel.logs_dir%/%kernel.environment%.log" 20 | level: debug 21 | console: 22 | type: console 23 | bubble: false 24 | # uncomment to get logging in your browser 25 | # you may have to allow bigger header sizes in your Web server configuration 26 | #firephp: 27 | # type: firephp 28 | # level: info 29 | #chromephp: 30 | # type: chromephp 31 | # level: info 32 | 33 | assetic: 34 | use_controller: "%use_assetic_controller%" 35 | 36 | swiftmailer: 37 | disable_delivery: true 38 | -------------------------------------------------------------------------------- /app/config/config_prod.yml: -------------------------------------------------------------------------------- 1 | imports: 2 | - { resource: config.yml } 3 | 4 | #framework: 5 | # validation: 6 | # cache: apc 7 | 8 | #doctrine: 9 | # orm: 10 | # metadata_cache_driver: apc 11 | # result_cache_driver: apc 12 | # query_cache_driver: apc 13 | 14 | monolog: 15 | handlers: 16 | main: 17 | type: fingers_crossed 18 | action_level: error 19 | handler: nested 20 | nested: 21 | type: stream 22 | path: "php://stderr" 23 | level: debug 24 | console: 25 | type: console 26 | -------------------------------------------------------------------------------- /app/config/config_test.yml: -------------------------------------------------------------------------------- 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 10 | 11 | web_profiler: 12 | toolbar: false 13 | intercept_redirects: false 14 | 15 | swiftmailer: 16 | disable_delivery: true 17 | -------------------------------------------------------------------------------- /app/config/parameters.yml.dist: -------------------------------------------------------------------------------- 1 | # This file is a "template" of what your parameters.yml file should look like 2 | parameters: 3 | database_driver: pdo_mysql 4 | database_host: "%database.host%" 5 | database_port: ~ 6 | database_name: "%database.name%" 7 | database_user: "%database.user%" 8 | database_password: "%database.password%" 9 | # You should uncomment this if you want use pdo_sqlite 10 | # database_path: "%kernel.root_dir%/data.db3" 11 | 12 | mailer_transport: smtp 13 | mailer_host: 127.0.0.1 14 | mailer_user: ~ 15 | mailer_password: ~ 16 | 17 | locale: en 18 | 19 | # A secret key that's used to generate certain security-related tokens 20 | secret: ThisTokenIsNotSoSecretChangeIt 21 | 22 | debug_toolbar: true 23 | debug_redirects: false 24 | use_assetic_controller: true 25 | -------------------------------------------------------------------------------- /app/config/parameters_dev.yml: -------------------------------------------------------------------------------- 1 | # This file is auto-generated during the composer install 2 | parameters: 3 | database_driver: pdo_mysql 4 | database_host: 127.0.0.1 5 | database_port: null 6 | database_name: quickstart 7 | database_user: root 8 | database_password: null 9 | mailer_transport: smtp 10 | mailer_host: 127.0.0.1 11 | mailer_user: null 12 | mailer_password: null 13 | locale: en 14 | secret: ThisTokenIsNotSoSecretChangeIt 15 | debug_toolbar: true 16 | debug_redirects: false 17 | use_assetic_controller: true 18 | -------------------------------------------------------------------------------- /app/config/routing.yml: -------------------------------------------------------------------------------- 1 | fos_user: 2 | resource: "@FOSUserBundle/Resources/config/routing/all.xml" 3 | 4 | quickstart_app: 5 | resource: "@QuickstartAppBundle/Resources/config/routing.yml" 6 | prefix: / 7 | -------------------------------------------------------------------------------- /app/config/routing_dev.yml: -------------------------------------------------------------------------------- 1 | _wdt: 2 | resource: "@WebProfilerBundle/Resources/config/routing/wdt.xml" 3 | prefix: /_wdt 4 | 5 | _profiler: 6 | resource: "@WebProfilerBundle/Resources/config/routing/profiler.xml" 7 | prefix: /_profiler 8 | 9 | _configurator: 10 | resource: "@SensioDistributionBundle/Resources/config/routing/webconfigurator.xml" 11 | prefix: /_configurator 12 | 13 | _main: 14 | resource: routing.yml 15 | -------------------------------------------------------------------------------- /app/config/security.yml: -------------------------------------------------------------------------------- 1 | security: 2 | encoders: 3 | FOS\UserBundle\Model\UserInterface: sha512 4 | 5 | role_hierarchy: 6 | ROLE_ADMIN: ROLE_USER 7 | ROLE_SUPER_ADMIN: ROLE_ADMIN 8 | 9 | providers: 10 | fos_userbundle: 11 | id: fos_user.user_provider.username_email 12 | 13 | firewalls: 14 | main: 15 | pattern: ^/ 16 | form_login: 17 | provider: fos_userbundle 18 | csrf_provider: form.csrf_provider 19 | check_path: fos_user_security_check 20 | default_target_path: quickstart_app_account 21 | login_path: fos_user_security_login 22 | failure_path: fos_user_security_login 23 | logout: 24 | path: fos_user_security_logout 25 | anonymous: true 26 | 27 | dev: 28 | pattern: ^/(_(profiler|wdt)|css|images|js)/ 29 | security: false 30 | 31 | access_control: 32 | - { path: ^/en/login$, role: IS_AUTHENTICATED_ANONYMOUSLY } 33 | - { path: ^/en/register, role: IS_AUTHENTICATED_ANONYMOUSLY } 34 | - { path: ^/en/resetting, role: IS_AUTHENTICATED_ANONYMOUSLY } 35 | - { path: ^/en/admin/, role: ROLE_ADMIN } 36 | - { path: ^/en/account, role: ROLE_USER } 37 | - { path: ^/fr/login$, role: IS_AUTHENTICATED_ANONYMOUSLY } 38 | - { path: ^/fr/register, role: IS_AUTHENTICATED_ANONYMOUSLY } 39 | - { path: ^/fr/resetting, role: IS_AUTHENTICATED_ANONYMOUSLY } 40 | - { path: ^/fr/admin/, role: ROLE_ADMIN } 41 | - { path: ^/fr/account, role: ROLE_USER } 42 | -------------------------------------------------------------------------------- /app/console: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env php 2 | getParameterOption(array('--env', '-e'), getenv('SYMFONY_ENV') ?: 'dev'); 19 | $debug = getenv('SYMFONY_DEBUG') !== '0' && !$input->hasParameterOption(array('--no-debug', '')) && $env !== 'prod'; 20 | 21 | if ($debug) { 22 | Debug::enable(); 23 | } 24 | 25 | $kernel = new AppKernel($env, $debug); 26 | $application = new Application($kernel); 27 | $application->run($input); 28 | -------------------------------------------------------------------------------- /app/logs/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eddiejaoude/SymfonyQuickStart/ba7f4807f1fd7a750a999de4f3f8aef22277170e/app/logs/.gitkeep -------------------------------------------------------------------------------- /app/phpunit.xml.dist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 10 | 11 | 12 | ../src/*/*Bundle/Tests 13 | ../src/*/Bundle/*Bundle/Tests 14 | 15 | 16 | 17 | 22 | 23 | 24 | 25 | ../src 26 | 27 | ../src/*/*Bundle/Resources 28 | ../src/*/*Bundle/Tests 29 | ../src/*/Bundle/*Bundle/Resources 30 | ../src/*/Bundle/*Bundle/Tests 31 | 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /changelog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eddiejaoude/SymfonyQuickStart/ba7f4807f1fd7a750a999de4f3f8aef22277170e/changelog -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "EddieJaoude/SymfonyQuickstart", 3 | "license": "MIT", 4 | "type": "project", 5 | "description": "Symfony quickstart & best practice tools - Behat 3, PHPSpec 2, PHPUnit 4 & Twitter Bootstrap 3", 6 | "autoload": { 7 | "psr-0": { "": "src/", "SymfonyStandard": "app/" } 8 | }, 9 | "require": { 10 | "php": "~5.5", 11 | "ext-mbstring": "*", 12 | "symfony/symfony": "2.6.*", 13 | "doctrine/orm": "~2.2,>=2.2.3", 14 | "doctrine/doctrine-bundle": "~1.2", 15 | "twig/extensions": "~1.0", 16 | "symfony/assetic-bundle": "~2.3", 17 | "symfony/swiftmailer-bundle": "~2.3", 18 | "symfony/monolog-bundle": "~2.4", 19 | "sensio/distribution-bundle": "~3.0", 20 | "sensio/framework-extra-bundle": "~3.0", 21 | "incenteev/composer-parameter-handler": "~2.0", 22 | "braincrafted/bootstrap-bundle": "~2.0", 23 | "knplabs/knp-menu-bundle": "~2.0", 24 | "jms/i18n-routing-bundle": "1.1.*", 25 | "symfony/yaml": "2.6.*", 26 | "twbs/bootstrap": "3.3.*", 27 | "jquery/jquery": "1.11.1", 28 | "friendsofsymfony/user-bundle": "~2.0@dev", 29 | "eddiejaoude/eddie-jaoude-symfony-translation-twig-collection-bundle": "0.1.*", 30 | "eddiejaoude/dev-helper-cmds": "dev-master", 31 | "doctrine/doctrine-fixtures-bundle": "2.2.*" 32 | }, 33 | "require-dev": { 34 | "heroku/heroku-buildpack-php": "*", 35 | "sensio/generator-bundle": "2.5.*", 36 | "behat/behat": "3.0.*", 37 | "behat/symfony2-extension": "~2.0@dev", 38 | "behat/mink-extension": "~2.0@dev", 39 | "behat/mink-browserkit-driver": "~1.1@dev", 40 | "behat/mink-goutte-driver": "*@dev", 41 | "behat/mink-selenium2-driver": "1.*", 42 | "guzzlehttp/guzzle": "5.*", 43 | "chartinger/behat-twig-report-extension": "*@dev", 44 | "phpunit/phpunit": "4.*@stable", 45 | "phpspec/phpspec": "~2.0", 46 | "codegyre/robo": "*", 47 | "henrikbjorn/phpspec-code-coverage": "~0.2" 48 | }, 49 | "scripts": { 50 | "post-root-package-install": [ 51 | "SymfonyStandard\\Composer::hookRootPackageInstall" 52 | ], 53 | "post-install-cmd": [ 54 | "Incenteev\\ParameterHandler\\ScriptHandler::buildParameters", 55 | "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap", 56 | "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache", 57 | "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets", 58 | "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile", 59 | "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::removeSymfonyStandardFiles", 60 | "Braincrafted\\Bundle\\BootstrapBundle\\Composer\\ScriptHandler::install", 61 | "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache" 62 | ], 63 | "post-update-cmd": [ 64 | "Incenteev\\ParameterHandler\\ScriptHandler::buildParameters", 65 | "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap", 66 | "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache", 67 | "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets", 68 | "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile", 69 | "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::removeSymfonyStandardFiles", 70 | "Braincrafted\\Bundle\\BootstrapBundle\\Composer\\ScriptHandler::install", 71 | "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache" 72 | ] 73 | }, 74 | "config": { 75 | "bin-dir": "bin" 76 | }, 77 | "extra": { 78 | "symfony-app-dir": "app", 79 | "symfony-web-dir": "web", 80 | "incenteev-parameters": { 81 | "file": "app/config/parameters.yml" 82 | }, 83 | "branch-alias": { 84 | "dev-master": "2.5-dev" 85 | } 86 | }, 87 | "repositories": [ 88 | { 89 | "type": "package", 90 | "package": { 91 | "name": "jquery/jquery", 92 | "version": "1.11.1", 93 | "dist": { 94 | "url": "http://code.jquery.com/jquery-1.11.1.js", 95 | "type": "file" 96 | } 97 | } 98 | } 99 | ] 100 | } 101 | -------------------------------------------------------------------------------- /doc/DefinitionOfDone.md: -------------------------------------------------------------------------------- 1 | # Definition of Done 2 | 3 | Return to [Table of Contents](/README.md#table-of-contents) 4 | 5 | Please refer to Transform standard [Definition of Done](https://github.com/TransformCore/documentation-templates/blob/master/definition-of-done.md) 6 | 7 | In addition to the standard template mentioned above, append the following: 8 | 9 | * [ ] Browser support 10 | * [ ] Firefox (latest) 11 | * [ ] Chrome (latest) 12 | * [ ] Safari (Mac only) 13 | * [ ] Internet Explorer (Windows only) 14 | * [ ] v8 15 | * [ ] v9 16 | * [ ] v10 17 | -------------------------------------------------------------------------------- /doc/Localisation.md: -------------------------------------------------------------------------------- 1 | # Localisation 2 | 3 | Return to [Table of Contents](/README.md#table-of-contents) 4 | 5 | Language files are within in relevant bundle in the following location `{Bundle}/Resources/translations/*.yml` 6 | 7 | Wihin the twig template & navigation builder, these `keys` must match with the `keys` & `paths` in the translation yaml files mention above. 8 | 9 | More information can be found at http://symfony.com/doc/current/book/translation.html 10 | -------------------------------------------------------------------------------- /doc/PageLayout.md: -------------------------------------------------------------------------------- 1 | # Page / Template Layout 2 | 3 | Return to [Table of Contents](/README.md#table-of-contents) 4 | 5 | Click on the Build / Version number to go to the Changelog page. 6 | 7 | ![Page / Template Layout](/doc/assets/pagelayout/layout.png "Page / Template Layout") 8 | 9 | ## Development / Test Toolbar 10 | 11 | Git toolbar added. 12 | 13 | ![Toolbar](/doc/assets/pagelayout/toolbar.png "Toolbar") 14 | -------------------------------------------------------------------------------- /doc/Registration.md: -------------------------------------------------------------------------------- 1 | # User Registration 2 | 3 | Most of the building blocks are part of the [Entity](src/Quickstart/Bundle/AppBundle/Entity) 4 | -------------------------------------------------------------------------------- /doc/Symfony.md: -------------------------------------------------------------------------------- 1 | Symfony Standard Edition 2 | ======================== 3 | 4 | Welcome to the Symfony Standard Edition - a fully-functional Symfony2 5 | application that you can use as the skeleton for your new applications. 6 | 7 | This document contains information on how to download, install, and start 8 | using Symfony. For a more detailed explanation, see the [Installation][1] 9 | chapter of the Symfony Documentation. 10 | 11 | 1) Installing the Standard Edition 12 | ---------------------------------- 13 | 14 | When it comes to installing the Symfony Standard Edition, you have the 15 | following options. 16 | 17 | ### Use Composer (*recommended*) 18 | 19 | As Symfony uses [Composer][2] to manage its dependencies, the recommended way 20 | to create a new project is to use it. 21 | 22 | If you don't have Composer yet, download it following the instructions on 23 | http://getcomposer.org/ or just run the following command: 24 | 25 | curl -s http://getcomposer.org/installer | php 26 | 27 | Then, use the `create-project` command to generate a new Symfony application: 28 | 29 | php composer.phar create-project symfony/framework-standard-edition path/to/install 30 | 31 | Composer will install Symfony and all its dependencies under the 32 | `path/to/install` directory. 33 | 34 | ### Download an Archive File 35 | 36 | To quickly test Symfony, you can also download an [archive][3] of the Standard 37 | Edition and unpack it somewhere under your web server root directory. 38 | 39 | If you downloaded an archive "without vendors", you also need to install all 40 | the necessary dependencies. Download composer (see above) and run the 41 | following command: 42 | 43 | php composer.phar install 44 | 45 | 2) Checking your System Configuration 46 | ------------------------------------- 47 | 48 | Before starting coding, make sure that your local system is properly 49 | configured for Symfony. 50 | 51 | Execute the `check.php` script from the command line: 52 | 53 | php app/check.php 54 | 55 | The script returns a status code of `0` if all mandatory requirements are met, 56 | `1` otherwise. 57 | 58 | Access the `config.php` script from a browser: 59 | 60 | http://localhost/path-to-project/web/config.php 61 | 62 | If you get any warnings or recommendations, fix them before moving on. 63 | 64 | 3) Browsing the Demo Application 65 | -------------------------------- 66 | 67 | Congratulations! You're now ready to use Symfony. 68 | 69 | From the `config.php` page, click the "Bypass configuration and go to the 70 | Welcome page" link to load up your first Symfony page. 71 | 72 | You can also use a web-based configurator by clicking on the "Configure your 73 | Symfony Application online" link of the `config.php` page. 74 | 75 | To see a real-live Symfony page in action, access the following page: 76 | 77 | web/app_dev.php/demo/hello/Fabien 78 | 79 | 4) Getting started with Symfony 80 | ------------------------------- 81 | 82 | This distribution is meant to be the starting point for your Symfony 83 | applications, but it also contains some sample code that you can learn from 84 | and play with. 85 | 86 | A great way to start learning Symfony is via the [Quick Tour][4], which will 87 | take you through all the basic features of Symfony2. 88 | 89 | Once you're feeling good, you can move onto reading the official 90 | [Symfony2 book][5]. 91 | 92 | A default bundle, `AcmeDemoBundle`, shows you Symfony2 in action. After 93 | playing with it, you can remove it by following these steps: 94 | 95 | * delete the `src/Acme` directory; 96 | 97 | * remove the routing entry referencing AcmeDemoBundle in `app/config/routing_dev.yml`; 98 | 99 | * remove the AcmeDemoBundle from the registered bundles in `app/AppKernel.php`; 100 | 101 | * remove the `web/bundles/acmedemo` directory; 102 | 103 | * empty the `security.yml` file or tweak the security configuration to fit 104 | your needs. 105 | 106 | What's inside? 107 | --------------- 108 | 109 | The Symfony Standard Edition is configured with the following defaults: 110 | 111 | * Twig is the only configured template engine; 112 | 113 | * Doctrine ORM/DBAL is configured; 114 | 115 | * Swiftmailer is configured; 116 | 117 | * Annotations for everything are enabled. 118 | 119 | It comes pre-configured with the following bundles: 120 | 121 | * **FrameworkBundle** - The core Symfony framework bundle 122 | 123 | * [**SensioFrameworkExtraBundle**][6] - Adds several enhancements, including 124 | template and routing annotation capability 125 | 126 | * [**DoctrineBundle**][7] - Adds support for the Doctrine ORM 127 | 128 | * [**TwigBundle**][8] - Adds support for the Twig templating engine 129 | 130 | * [**SecurityBundle**][9] - Adds security by integrating Symfony's security 131 | component 132 | 133 | * [**SwiftmailerBundle**][10] - Adds support for Swiftmailer, a library for 134 | sending emails 135 | 136 | * [**MonologBundle**][11] - Adds support for Monolog, a logging library 137 | 138 | * [**AsseticBundle**][12] - Adds support for Assetic, an asset processing 139 | library 140 | 141 | * **WebProfilerBundle** (in dev/test env) - Adds profiling functionality and 142 | the web debug toolbar 143 | 144 | * **SensioDistributionBundle** (in dev/test env) - Adds functionality for 145 | configuring and working with Symfony distributions 146 | 147 | * [**SensioGeneratorBundle**][13] (in dev/test env) - Adds code generation 148 | capabilities 149 | 150 | * **AcmeDemoBundle** (in dev/test env) - A demo bundle with some example 151 | code 152 | 153 | All libraries and bundles included in the Symfony Standard Edition are 154 | released under the MIT or BSD license. 155 | 156 | Enjoy! 157 | 158 | [1]: http://symfony.com/doc/2.5/book/installation.html 159 | [2]: http://getcomposer.org/ 160 | [3]: http://symfony.com/download 161 | [4]: http://symfony.com/doc/2.5/quick_tour/the_big_picture.html 162 | [5]: http://symfony.com/doc/2.5/index.html 163 | [6]: http://symfony.com/doc/2.5/bundles/SensioFrameworkExtraBundle/index.html 164 | [7]: http://symfony.com/doc/2.5/book/doctrine.html 165 | [8]: http://symfony.com/doc/2.5/book/templating.html 166 | [9]: http://symfony.com/doc/2.5/book/security.html 167 | [10]: http://symfony.com/doc/2.5/cookbook/email.html 168 | [11]: http://symfony.com/doc/2.5/cookbook/logging/monolog.html 169 | [12]: http://symfony.com/doc/2.5/cookbook/assetic/asset_management.html 170 | [13]: http://symfony.com/doc/2.5/bundles/SensioGeneratorBundle/index.html 171 | -------------------------------------------------------------------------------- /doc/Versioning.md: -------------------------------------------------------------------------------- 1 | # Versioning 2 | 3 | Return to [Table of Contents](/README.md#table-of-contents) 4 | 5 | Format: `build-{branch}-{build-number}` 6 | 7 | On successful build, the version/tag/build number is written to `/version`, this is then loaded into the web page template/layout (display below). 8 | 9 | This is also know as a **Release Candidate** 10 | 11 | ![Versioning](/doc/assets/versioning/layout.png "Version/Build Number Screenshot") 12 | -------------------------------------------------------------------------------- /doc/assets/contributing/badges.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eddiejaoude/SymfonyQuickStart/ba7f4807f1fd7a750a999de4f3f8aef22277170e/doc/assets/contributing/badges.png -------------------------------------------------------------------------------- /doc/assets/homepage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eddiejaoude/SymfonyQuickStart/ba7f4807f1fd7a750a999de4f3f8aef22277170e/doc/assets/homepage.png -------------------------------------------------------------------------------- /doc/assets/login.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eddiejaoude/SymfonyQuickStart/ba7f4807f1fd7a750a999de4f3f8aef22277170e/doc/assets/login.png -------------------------------------------------------------------------------- /doc/assets/pagelayout/layout.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eddiejaoude/SymfonyQuickStart/ba7f4807f1fd7a750a999de4f3f8aef22277170e/doc/assets/pagelayout/layout.png -------------------------------------------------------------------------------- /doc/assets/pagelayout/toolbar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eddiejaoude/SymfonyQuickStart/ba7f4807f1fd7a750a999de4f3f8aef22277170e/doc/assets/pagelayout/toolbar.png -------------------------------------------------------------------------------- /doc/assets/register-fr.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eddiejaoude/SymfonyQuickStart/ba7f4807f1fd7a750a999de4f3f8aef22277170e/doc/assets/register-fr.png -------------------------------------------------------------------------------- /doc/assets/register.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eddiejaoude/SymfonyQuickStart/ba7f4807f1fd7a750a999de4f3f8aef22277170e/doc/assets/register.png -------------------------------------------------------------------------------- /doc/assets/versioning/layout.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eddiejaoude/SymfonyQuickStart/ba7f4807f1fd7a750a999de4f3f8aef22277170e/doc/assets/versioning/layout.png -------------------------------------------------------------------------------- /src/.htaccess: -------------------------------------------------------------------------------- 1 | 2 | Require all denied 3 | 4 | 5 | Order deny,allow 6 | Deny from all 7 | 8 | -------------------------------------------------------------------------------- /src/Quickstart/Bundle/AppBundle/Controller/AccountController.php: -------------------------------------------------------------------------------- 1 | templating = $templating; 22 | } 23 | 24 | /** 25 | * @return \Symfony\Component\HttpFoundation\Response 26 | */ 27 | public function indexAction() 28 | { 29 | return $this->templating->renderResponse('QuickstartAppBundle:Account:index.html.twig', 30 | array( 31 | 32 | ) 33 | ); 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /src/Quickstart/Bundle/AppBundle/Controller/DefaultController.php: -------------------------------------------------------------------------------- 1 | templating = $templating; 22 | } 23 | 24 | /** 25 | * @return \Symfony\Component\HttpFoundation\Response 26 | */ 27 | public function indexAction() 28 | { 29 | return $this->templating->renderResponse('QuickstartAppBundle:Default:index.html.twig'); 30 | } 31 | 32 | /** 33 | * @return \Symfony\Component\HttpFoundation\Response 34 | */ 35 | public function changelogAction() 36 | { 37 | return $this->templating->renderResponse( 38 | 'QuickstartAppBundle:Default:changelog.html.twig', 39 | array( 40 | 'changelog' => file('../changelog') 41 | ) 42 | ); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/Quickstart/Bundle/AppBundle/DataFixtures/ORM/LoadUserData.php: -------------------------------------------------------------------------------- 1 | addUser($manager); 21 | 22 | $manager->flush(); 23 | } 24 | 25 | public function addUser(ObjectManager $manager) 26 | { 27 | $user = new User(); 28 | $user->setFirstname('admin'); 29 | $user->setLastname('test'); 30 | $user->setUsername('admin@test.com'); 31 | $user->setEmail('admin@test.com'); 32 | $user->setPlainPassword('password'); 33 | $user->setEnabled(true); 34 | $manager->persist($user); 35 | 36 | return $this; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/Quickstart/Bundle/AppBundle/DependencyInjection/Configuration.php: -------------------------------------------------------------------------------- 1 | root('quickstart_app'); 22 | 23 | // Here you should define the parameters that are allowed to 24 | // configure your bundle. See the documentation linked above for 25 | // more information on that topic. 26 | 27 | return $treeBuilder; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/Quickstart/Bundle/AppBundle/DependencyInjection/QuickstartAppExtension.php: -------------------------------------------------------------------------------- 1 | processConfiguration($configuration, $configs); 24 | 25 | $loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config')); 26 | $loader->load('services.yml'); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/Quickstart/Bundle/AppBundle/Entity/User.php: -------------------------------------------------------------------------------- 1 | id; 35 | } 36 | 37 | /** 38 | * @param int $id 39 | * 40 | * @return User 41 | */ 42 | public function setId($id) 43 | { 44 | $this->id = (int) $id; 45 | 46 | return $this; 47 | } 48 | 49 | /** 50 | * @return string 51 | */ 52 | public function getFirstname() 53 | { 54 | return $this->firstname; 55 | } 56 | 57 | /** 58 | * @param string $firstname 59 | * 60 | * @return User 61 | */ 62 | public function setFirstname($firstname) 63 | { 64 | $this->firstname = (string) $firstname; 65 | 66 | return $this; 67 | } 68 | 69 | /** 70 | * @return string 71 | */ 72 | public function getLastname() 73 | { 74 | return $this->lastname; 75 | } 76 | 77 | /** 78 | * @param string $lastname 79 | * 80 | * @return User 81 | */ 82 | public function setLastname($lastname) 83 | { 84 | $this->lastname = (string) $lastname; 85 | 86 | return $this; 87 | } 88 | 89 | /** 90 | * @return string 91 | */ 92 | public function __toString() 93 | { 94 | return $this->getEmail(); 95 | } 96 | } 97 | -------------------------------------------------------------------------------- /src/Quickstart/Bundle/AppBundle/EventListener/RegistrationListener.php: -------------------------------------------------------------------------------- 1 | router = $router; 40 | $this->generator = $generator; 41 | } 42 | 43 | /** 44 | * @return array 45 | */ 46 | public static function getSubscribedEvents() 47 | { 48 | return array( 49 | FOSUserEvents::REGISTRATION_INITIALIZE => 'onRegistrationInit', 50 | FOSUserEvents::REGISTRATION_SUCCESS => 'onRegistrationSuccess', 51 | ); 52 | } 53 | 54 | /** 55 | * take action when registration is initialized 56 | * set the username to a unique id 57 | * 58 | * @param UserEvent $event 59 | */ 60 | public function onRegistrationInit(UserEvent $event) 61 | { 62 | $user = $event->getUser(); 63 | $user->setUsername( 64 | $this->generator->getUsername() 65 | ); 66 | } 67 | 68 | /** 69 | * @param FormEvent $event 70 | */ 71 | public function onRegistrationSuccess(FormEvent $event) 72 | { 73 | $url = $this->router->generate('quickstart_app_account'); 74 | 75 | $event->setResponse(new RedirectResponse($url)); 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /src/Quickstart/Bundle/AppBundle/Features/Homepage/homepage.feature: -------------------------------------------------------------------------------- 1 | Feature: As an applicant, after logging in, I want to see my homepage 2 | 3 | Scenario: 4 | Given I am logged in as "admin@test.com" with password "password" 5 | Then I should see "My Account" 6 | And I should see "admin@test.com" 7 | And I should see "Logout" 8 | And I should not see "Login" 9 | -------------------------------------------------------------------------------- /src/Quickstart/Bundle/AppBundle/Features/Registraton/Register.feature: -------------------------------------------------------------------------------- 1 | Feature: As an user, I want to be able to register a new account 2 | 3 | Scenario Outline: Create Account with valid details 4 | Given I am on the homepage 5 | And I follow "Register" 6 | Then I should see "Register Your Details" 7 | When I fill form with: 8 | # Your details 9 | | fos_user_registration_form_firstname | | 10 | | fos_user_registration_form_lastname | | 11 | # Contact details 12 | | fos_user_registration_form_email | | 13 | # Signin Details 14 | | fos_user_registration_form_plainPassword_first | | 15 | | fos_user_registration_form_plainPassword_second | | 16 | And I press "fos_user_registration_form_registerButton" 17 | Then I should see "My Account" 18 | And I should see "" 19 | # And I should get an email on "" with: 20 | # """ 21 | # Confirmation email content detail here 22 | # """ 23 | 24 | Examples: 25 | | first-name | last-name | email-input | password | 26 | | One | Persona | test@test.com | password1! | 27 | 28 | Scenario: Create account with invalid details (field formats) 29 | Given I am on the homepage 30 | And I follow "Register" 31 | Then I should see "Register Your Details" 32 | # Your details 33 | And I fill in "fos_user_registration_form_firstname" with "Bil2" 34 | And I fill in "fos_user_registration_form_lastname" with "Ca2rr" 35 | # Contact details 36 | And I fill in "fos_user_registration_form_email" with "bill.carr@test" 37 | # Signin Details 38 | And I fill in "fos_user_registration_form_plainPassword_first" with "P@ssword1" 39 | And I fill in "fos_user_registration_form[plainPassword][second]" with "P@ssword11" 40 | And I press "fos_user_registration_form_registerButton" 41 | Then I should see "This value should be of type alpha" 42 | Then I should see "This value should be of type alpha" 43 | Then I should see "The entered passwords don't match" 44 | Then I should see "This value is not a valid email address" 45 | 46 | Scenario Outline: Create account with invalid details (password check) 47 | Given I am on the homepage 48 | And I follow "Register" 49 | Then I should see "Register Your Details" 50 | And I fill in "fos_user_registration_form_firstname" with "Bill" 51 | And I fill in "fos_user_registration_form_lastname" with "Carr" 52 | And I fill in "fos_user_registration_form_plainPassword_first" with "" 53 | And I fill in "fos_user_registration_form[plainPassword][second]" with "" 54 | And I fill in "fos_user_registration_form_email" with "bill.carr@test.com" 55 | And I press "fos_user_registration_form_registerButton" 56 | Examples: 57 | | password | 58 | | 1234567 | 59 | | 12345678 | 60 | | abcdefgh | 61 | | abcdefgh1 | 62 | | abcdefgh@ | 63 | 64 | Scenario Outline: Create account with invalid details (password) 65 | Given I am on the homepage 66 | And I follow "Register" 67 | Then I should see "Register Your Details" 68 | And I fill in "fos_user_registration_form_firstname" with "Bill" 69 | And I fill in "fos_user_registration_form_lastname" with "Carr" 70 | And I fill in "fos_user_registration_form_plainPassword_first" with "" 71 | And I fill in "fos_user_registration_form[plainPassword][second]" with "" 72 | And I fill in "fos_user_registration_form_email" with "bill.carr@test.com" 73 | And I press "fos_user_registration_form_registerButton" 74 | Then I should see "" 75 | Examples: 76 | | password | Message | 77 | | 1234567 | This value is too short. It should have 8 characters or more | 78 | | 12345678 | Must contain at least 1 letter | 79 | | abcdefgh | Must contain at least 1 number | 80 | | 1bcdefgh | Must contain at least 1 symbol (eg. !@#$%^*_-) | 81 | 82 | Scenario: Create account using blank form text fields (mandatory field check) 83 | Given I am on the homepage 84 | And I follow "Register" 85 | And I press "fos_user_registration_form_registerButton" 86 | Then I should see "This value should not be blank" 87 | And I fill in "fos_user_registration_form_firstname" with "Four" 88 | And I press "fos_user_registration_form_registerButton" 89 | Then I should see "This value should not be blank" 90 | And I fill in "fos_user_registration_form_lastname" with "Persona" 91 | And I fill in "fos_user_registration_form_email" with "email@test" 92 | And I press "fos_user_registration_form_registerButton" 93 | Then I should see "This value is not a valid email address" 94 | And I fill in "fos_user_registration_form_email" with "persona4@test.com" 95 | And I press "fos_user_registration_form_registerButton" 96 | Then I should see "This value should not be blank" 97 | And I fill in "fos_user_registration_form_plainPassword_first" with "P@ssword1" 98 | And I press "fos_user_registration_form_registerButton" 99 | Then I should see "The entered passwords don't match" 100 | And I fill in "fos_user_registration_form_plainPassword_first" with "P@ssword1" 101 | And I fill in "fos_user_registration_form_plainPassword_second" with "P@ssword1" 102 | And I press "fos_user_registration_form_registerButton" 103 | And I should see "My Account" 104 | 105 | Scenario Outline: Create account using email that has already been used 106 | Given I am on the homepage 107 | And I follow "Register" 108 | And I fill in "fos_user_registration_form_email" with "" 109 | And I fill in "fos_user_registration_form_firstname" with "" 110 | And I fill in "fos_user_registration_form_lastname" with "" 111 | And I fill in "fos_user_registration_form_plainPassword_first" with "" 112 | And I fill in "fos_user_registration_form[plainPassword][second]" with "" 113 | And I press "fos_user_registration_form_registerButton" 114 | Then I should see "This value is already used" 115 | Examples: 116 | | email | 117 | | admin@test.com | 118 | -------------------------------------------------------------------------------- /src/Quickstart/Bundle/AppBundle/Features/Security/Login.feature: -------------------------------------------------------------------------------- 1 | Feature: As a user, I want to be able to login, in order to manage my account and process applications 2 | 3 | Background: 4 | Given following users for each persona exist on system: 5 | | admin@test.com | 6 | 7 | @CSR-5 8 | Scenario Outline: Login (Valid details) 9 | Given I am on the homepage 10 | And I follow "Login" 11 | And I fill in "username" with "" 12 | And I fill in "password" with "" 13 | And I press "Login" 14 | Then I should see "" 15 | 16 | Examples: 17 | | email-input | password | message | 18 | | admin@test.com | password | My Account | 19 | 20 | @CSR-5 21 | Scenario Outline: Login (Invalid password) 22 | Given I am on the homepage 23 | And I follow "Login" 24 | And I fill in "username" with "" 25 | And I fill in "password" with "" 26 | And I press "Login" 27 | Then I should see "" 28 | 29 | Examples: 30 | | email-input | password | message | 31 | | admin@test.com | P@ssword | Invalid credentials | 32 | | persona3@test.com | p@ssword1 | Invalid credentials | 33 | 34 | @CSR-5 35 | Scenario Outline: Login (Invalid username) 36 | Given I am on the homepage 37 | And I follow "Login" 38 | And I fill in "username" with "" 39 | And I fill in "password" with "" 40 | And I press "Login" 41 | Then I should see "" 42 | 43 | Examples: 44 | | email-input | password | message | 45 | | nonexistent@test.com | P@ssword1 | Invalid credentials | 46 | 47 | @CSR-5 48 | Scenario: Redirect to Login (permission denied) 49 | Given I am on the homepage 50 | And I go to "/en/account" 51 | Then I should see "Email address" 52 | And I should see "Password" 53 | -------------------------------------------------------------------------------- /src/Quickstart/Bundle/AppBundle/Features/changelog.feature: -------------------------------------------------------------------------------- 1 | Feature: Changlog 2 | 3 | Scenario: Viewing the changelog 4 | Given I am on "/changelog" 5 | Then I should see "Changelog" 6 | -------------------------------------------------------------------------------- /src/Quickstart/Bundle/AppBundle/Features/homepage.feature: -------------------------------------------------------------------------------- 1 | Feature: Homepage in English 2 | 3 | Scenario: Homepage 4 | Given I am on "/" 5 | Then I should see "Home" 6 | And I should see "Overview" 7 | 8 | Scenario: Homepage 9 | Given I am on "/en" 10 | Then I should see "Home" 11 | And I should see "Overview" 12 | -------------------------------------------------------------------------------- /src/Quickstart/Bundle/AppBundle/Features/homepage.fr.feature: -------------------------------------------------------------------------------- 1 | Feature: Homepage in French 2 | 3 | Scenario: Homepage 4 | Given I am on "/fr" 5 | Then I should see "Accueil" 6 | And I should see "Overview" 7 | -------------------------------------------------------------------------------- /src/Quickstart/Bundle/AppBundle/Features/localisation.feature: -------------------------------------------------------------------------------- 1 | Feature: Localisation 2 | 3 | Scenario: Switching localisation 4 | Given I am on "/en/login" 5 | Then I should see "Email Address" 6 | When I follow "fr" 7 | Then I should see "Adresse e-mail" 8 | -------------------------------------------------------------------------------- /src/Quickstart/Bundle/AppBundle/Features/navigation.feature: -------------------------------------------------------------------------------- 1 | Feature: Navigation 2 | 3 | Scenario: Viewing the main navigation 4 | Given I am on "/" 5 | Then I should see "Home" 6 | Then I should see "Login" 7 | 8 | Scenario: Viewing the main navigation 9 | Given I am on "/en" 10 | Then I should see "Home" 11 | Then I should see "Login" 12 | 13 | Scenario: Viewing the language navigation 14 | Given I am on "/" 15 | Then I should see "en" 16 | Then I should see "fr" 17 | 18 | Scenario: Viewing the language navigation 19 | Given I am on "/en" 20 | Then I should see "en" 21 | Then I should see "fr" 22 | -------------------------------------------------------------------------------- /src/Quickstart/Bundle/AppBundle/Features/navigation.fr.feature: -------------------------------------------------------------------------------- 1 | Feature: Navigation in French 2 | 3 | Scenario: Viewing the main navigation 4 | Given I am on "/fr" 5 | Then I should see "Accueil" 6 | Then I should see "S'identifier" 7 | 8 | Scenario: Viewing the language navigation 9 | Given I am on "/fr" 10 | Then I should see "en" 11 | Then I should see "fr" 12 | -------------------------------------------------------------------------------- /src/Quickstart/Bundle/AppBundle/Form/RegistrationFormType.php: -------------------------------------------------------------------------------- 1 | remove('username') 40 | ->add('firstname', 'text', array('label' => 'register.form.firstname.label')) 41 | ->add('lastname', 'text', array('label' => 'register.form.lastname.label')) 42 | ->add('email', 'text', array('label' => 'register.form.email.label')) 43 | ->add('plainPassword', 'repeated', 44 | array( 45 | 'type' => 'password', 46 | 'first_options' => array('label' => 'register.form.password.label'), 47 | 'second_options' => array('label' => 'register.form.password-confirm.label'), 48 | 'invalid_message' => 'fos_user.password.mismatch', 49 | ) 50 | ) 51 | ->add('registerButton', 'submit', array('label' => 'register.form.register-button.label')); 52 | } 53 | 54 | /** 55 | * @param OptionsResolverInterface $resolver 56 | */ 57 | public function setDefaultOptions(OptionsResolverInterface $resolver) 58 | { 59 | $resolver->setDefaults( 60 | array( 61 | 'data_class' => 'Quickstart\Bundle\AppBundle\Entity\User', 62 | ) 63 | ); 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /src/Quickstart/Bundle/AppBundle/Menu/MenuBuilder.php: -------------------------------------------------------------------------------- 1 | factory = $factory; 30 | $this->securityContext = $securityContext; 31 | } 32 | 33 | /** 34 | * @TODO: Move below to config 35 | * 36 | * @param Request $request 37 | * 38 | * @return \Knp\Menu\ItemInterface 39 | */ 40 | public function createMainMenu(Request $request) 41 | { 42 | $menu = $this->factory->createItem('root'); 43 | $menu->setChildrenAttributes(array('class' => 'navbar-nav nav')); 44 | 45 | $menu->addChild('nav.home', array('route' => 'quickstart_app_homepage')); 46 | 47 | if ($this->securityContext->isGranted('IS_AUTHENTICATED_FULLY')) { 48 | $menu->addChild( 49 | $this->securityContext->getToken()->getUser()->getEmail(), 50 | array('route' => 'quickstart_app_account') 51 | ); 52 | $menu->addChild('nav.logout', array('route' => 'fos_user_security_logout')); 53 | } else { 54 | $menu->addChild('nav.register', array('route' => 'fos_user_registration_register')); 55 | $menu->addChild('nav.login', array('route' => 'fos_user_security_login')); 56 | } 57 | 58 | return $menu; 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /src/Quickstart/Bundle/AppBundle/QuickstartAppBundle.php: -------------------------------------------------------------------------------- 1 | 5 | 9 | 10 | {% endblock %} 11 | 12 | {% block title %} 13 | {% trans %}account.title{% endtrans %} 14 | {% endblock %} 15 | 16 | {% block body %} 17 | 18 |
19 | 20 |
21 |

{% trans %}account.title{% endtrans %}

22 |
23 | 24 |
25 | 26 |
27 | 28 |
29 | 30 |
31 | 32 | 42 | 43 | 52 | 53 |
54 | 55 |
56 |
57 | 61 | Your messages 62 | 2 63 |
64 | 65 | 71 | 72 |
73 | 74 |
75 | 76 |
77 | 78 |
79 |

Your progress

80 | 81 |
82 |
84 | 45% 85 |
86 |
87 | 88 |
89 | 1. Step 1 90 | 94 |
95 | 96 |
97 | 2. Step 2 98 | 102 |
103 | 104 |
105 |
3. Step 3 106 | 110 |
111 | 127 |
128 | 129 |
130 | 4. Step 4 131 | 135 |
136 | 137 |
138 | 5. Step 5 139 | 143 |
144 | 145 |
146 | 6. Step 6 147 | 151 |
152 | 153 |
154 | 7. Step 7 155 | 159 |
160 | 161 |
162 | 8. Step 8 163 | 167 |
168 | 169 |
170 | 171 |
172 | 173 |
174 | 175 | 176 | {% endblock %} 177 | -------------------------------------------------------------------------------- /src/Quickstart/Bundle/AppBundle/Resources/views/Default/changelog.html.twig: -------------------------------------------------------------------------------- 1 | {% extends "::base.html.twig" %} 2 | 3 | {% block breadcrumb %} 4 |
5 | 9 |
10 | {% endblock %} 11 | 12 | {% block title %}Changelog{% endblock %} 13 | 14 | {% block body %} 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | {% for commit in changelog %} 23 | 24 | 25 | 26 | {% endfor %} 27 | 28 |
Changelog
{{ commit }}
29 | {% endblock %} 30 | -------------------------------------------------------------------------------- /src/Quickstart/Bundle/AppBundle/Resources/views/Default/index.html.twig: -------------------------------------------------------------------------------- 1 | {% extends "::base.html.twig" %} 2 | 3 | {% block breadcrumb %} 4 |
5 | 9 |
10 | {% endblock %} 11 | 12 | {% block title %} 13 | {% trans %}home.title{% endtrans %} 14 | {% endblock %} 15 | 16 | {% block body %} 17 |
18 |
19 |
20 |

Main title

21 | 22 |

Subtitle

23 | 24 |

Consectetur adipiscing elit. Nunc eu enim arcu. Suspendisse tristique facilisis elit at 25 | dignissim. Proin eu sem non ipsum rutrum

26 | Register NOW! 27 |
28 |
29 | 30 |
31 | 32 |
33 |
34 |
Information 1
35 |
36 |

Lorem ipsum dolor sit amet. Nunc eu enim arcu. Suspendisse tristique facilisis elit at 37 | dignissim.

38 | 39 |

Lorem ipsum dolor sit amet. Nunc eu enim arcu. Suspendisse tristique facilisis elit at 40 | dignissim.

41 |

Lorem ipsum dolor sit amet.

42 | 43 | More information 44 |
45 |
46 |
47 |
48 | 49 |
50 |
51 |
Information 2
52 |
53 |

Lorem ipsum dolor sit amet. Nunc eu enim arcu. Suspendisse tristique facilisis elit at 54 | dignissim.

55 |

Lorem ipsum dolor sit amet. Nunc eu enim arcu. Suspendisse tristique facilisis elit at 56 | dignissim.

57 |

Lorem ipsum dolor sit amet.

58 | 59 | More information 60 |
61 |
62 |
63 |
64 | 65 |
66 |
67 |
Information 3
68 |
69 |

Lorem ipsum dolor sit amet. Nunc eu enim arcu. Suspendisse tristique facilisis elit at 70 | dignissim.

71 |

Lorem ipsum dolor sit amet. Nunc eu enim arcu. Suspendisse tristique facilisis elit at 72 | dignissim.

73 |

Lorem ipsum dolor sit amet.

74 | 75 | More information 76 |
77 |
78 |
79 |
80 | 81 |
82 |
83 |
Information 4
84 |
85 |

Lorem ipsum dolor sit amet. Nunc eu enim arcu. Suspendisse tristique facilisis elit at 86 | dignissim.

87 |

Lorem ipsum dolor sit amet. Nunc eu enim arcu. Suspendisse tristique facilisis elit at 88 | dignissim.

89 |

Lorem ipsum dolor sit amet.

90 | 91 | More information 92 |
93 |
94 |
95 |
96 | 97 |
98 | 99 |
100 | 101 |
102 |
103 |
Information 5
104 |
105 | 106 |

Lorem ipsum dolor sit amet. Nunc eu enim arcu.

107 |

Lorem ipsum dolor sit amet. Nunc eu enim arcu.

108 | More information 109 | 110 |
111 |
112 |
113 |
114 | 115 |
116 |
117 |
Information 6
118 |
119 | 120 |

Lorem ipsum dolor sit amet. Nunc eu enim arcu.

121 |

Lorem ipsum dolor sit amet. Nunc eu enim arcu.

122 | More information 123 | 124 |
125 |
126 |
127 |
128 | 129 |
130 |
131 |
Information 7
132 |
133 | 134 |

Lorem ipsum dolor sit amet. Nunc eu enim arcu.

135 |

Lorem ipsum dolor sit amet. Nunc eu enim arcu.

136 | More information 137 | 138 |
139 |
140 |
141 |
142 | 143 |
144 | 145 |
146 | 147 |
148 | 149 |
150 |
151 |
Information 8
152 |
153 | 154 |

Lorem ipsum dolor sit amet. Nunc eu enim arcu.

155 |

Lorem ipsum dolor sit amet. Nunc eu enim arcu.

156 | More information 157 | 158 |
159 |
160 |
161 |
162 | 163 |
164 |
165 |
Information 9
166 |
167 | 168 |

Lorem ipsum dolor sit amet. Nunc eu enim arcu.

169 |

Lorem ipsum dolor sit amet. Nunc eu enim arcu.

170 | More information 171 | 172 |
173 |
174 |
175 |
176 | 177 |
178 |
179 |
Information 10
180 |
181 | 182 |

Lorem ipsum dolor sit amet. Nunc eu enim arcu.

183 |

Lorem ipsum dolor sit amet. Nunc eu enim arcu.

184 | More information 185 | 186 |
187 |
188 |
189 |
190 | 191 |
192 |
193 | {% endblock %} 194 | -------------------------------------------------------------------------------- /src/Quickstart/Bundle/AppBundle/Resources/views/Default/knp_menu.html.twig: -------------------------------------------------------------------------------- 1 | {% extends 'knp_menu.html.twig' %} 2 | {% block label %}{{ item.label|trans(item.getExtra('translation_params', {}), item.getExtra('translation_domain', 'messages')) }}{% endblock %} 3 | -------------------------------------------------------------------------------- /src/Quickstart/Bundle/AppBundle/Service/RandomUsernameGenerator.php: -------------------------------------------------------------------------------- 1 | version = $version; 23 | } 24 | 25 | /** 26 | * @return string 27 | */ 28 | public function current() 29 | { 30 | return file_get_contents($this->version); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/Quickstart/Bundle/AppBundle/Tests/Controller/AccountControllerTest.php: -------------------------------------------------------------------------------- 1 | request('GET', 'account'); 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /src/Quickstart/Bundle/AppBundle/Tests/Controller/DefaultControllerTest.php: -------------------------------------------------------------------------------- 1 | request('GET', '/en/'); 14 | 15 | $this->assertTrue($crawler->filter('html:contains("Quickstart")')->count() > 0); 16 | } 17 | 18 | public function testIndexFr() 19 | { 20 | $client = static::createClient(); 21 | 22 | $crawler = $client->request('GET', '/fr/'); 23 | 24 | $this->assertTrue($crawler->filter('html:contains("Quickstart")')->count() > 0); 25 | } 26 | 27 | public function testChangelog() 28 | { 29 | $client = static::createClient(); 30 | 31 | $crawler = $client->request('GET', '/changelog'); 32 | 33 | $this->assertTrue($crawler->filter('html:contains("Changelog")')->count() > 0); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/Quickstart/Bundle/AppBundle/Tests/Spec/Quickstart/Bundle/AppBundle/DependencyInjection/ConfigurationSpec.php: -------------------------------------------------------------------------------- 1 | shouldHaveType('Quickstart\Bundle\AppBundle\DependencyInjection\Configuration'); 14 | } 15 | 16 | /** 17 | * @TODO: Improve Spec 18 | */ 19 | function it_should_get_config_tree_builder() 20 | { 21 | $this->getConfigTreeBuilder() 22 | ->shouldHaveType(new TreeBuilder()); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/Quickstart/Bundle/AppBundle/Tests/Spec/Quickstart/Bundle/AppBundle/DependencyInjection/QuickstartAppExtensionSpec.php: -------------------------------------------------------------------------------- 1 | shouldHaveType('Quickstart\Bundle\AppBundle\DependencyInjection\QuickstartAppExtension'); 14 | } 15 | 16 | /** 17 | * @TODO: Improve Spec 18 | */ 19 | function it_should_load(ContainerBuilder $container) 20 | { 21 | $this->load(array(), $container); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/Quickstart/Bundle/AppBundle/Tests/Spec/Quickstart/Bundle/AppBundle/EventListener/RegistrationListenerSpec.php: -------------------------------------------------------------------------------- 1 | beConstructedWith($router, $generator); 19 | } 20 | 21 | function it_is_initializable() 22 | { 23 | $this->shouldHaveType('Quickstart\Bundle\AppBundle\EventListener\RegistrationListener'); 24 | } 25 | 26 | function it_gets_subsribed_events() 27 | { 28 | $this->getSubscribedEvents() 29 | ->shouldBeArray(); 30 | } 31 | 32 | function its_on_registration_init( 33 | UserEvent $userEvent, 34 | User $user, 35 | UrlGeneratorInterface $router, 36 | RandomUsernameGenerator $generator 37 | ) 38 | { 39 | $generator 40 | ->getUsername() 41 | ->shouldBeCalled() 42 | ->willReturn('12345'); 43 | 44 | $this->beConstructedWith($router, $generator); 45 | 46 | $user 47 | ->setUsername('12345') 48 | ->shouldBeCalled(); 49 | 50 | $userEvent 51 | ->getUser() 52 | ->shouldBeCalled() 53 | ->willReturn($user); 54 | 55 | $this->onRegistrationInit($userEvent); 56 | } 57 | 58 | function its_on_registration_success( 59 | FormEvent $event, 60 | UrlGeneratorInterface $router, 61 | RandomUsernameGenerator $generator 62 | ) 63 | { 64 | $router 65 | ->generate('quickstart_app_account') 66 | ->shouldBeCalled() 67 | ->willReturn('/en/account'); 68 | 69 | $this->beConstructedWith($router, $generator); 70 | 71 | $event 72 | ->setResponse( 73 | Argument::type('Symfony\Component\HttpFoundation\RedirectResponse') 74 | ) 75 | ->shouldBeCalled(); 76 | 77 | $this->onRegistrationSuccess($event); 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /src/Quickstart/Bundle/AppBundle/Tests/Spec/Quickstart/Bundle/AppBundle/Menu/MenuBuilderSpec.php: -------------------------------------------------------------------------------- 1 | createItem('root')->shouldBeCalled()->willReturn($menu); 20 | // $this->beConstructedWith($factory, true); 21 | // } 22 | 23 | function it_is_initializable(FactoryInterface $factory, SecurityContext $securityContext) 24 | { 25 | $this->beConstructedWith($factory, $securityContext); 26 | $this->shouldHaveType('Quickstart\Bundle\AppBundle\Menu\MenuBuilder'); 27 | } 28 | 29 | function it_builds_the_menu_when_not_logged_in(FactoryInterface $factory, ItemInterface $menu, Request $request, SecurityContext $securityContext) 30 | { 31 | $menu->setChildrenAttributes(array('class' => 'navbar-nav nav')) 32 | ->shouldBeCalled() 33 | ->willReturn($menu); 34 | 35 | $menu->addChild('nav.home', array('route' => 'quickstart_app_homepage')) 36 | ->shouldBeCalled() 37 | ->willReturn($menu); 38 | 39 | $securityContext 40 | ->isGranted('IS_AUTHENTICATED_FULLY') 41 | ->shouldBeCalled() 42 | ->willReturn(false); 43 | 44 | $menu->addChild('nav.login', array('route' => 'fos_user_security_login')) 45 | ->shouldBeCalled() 46 | ->willReturn($menu); 47 | 48 | $menu->addChild('nav.register', array('route' => 'fos_user_registration_register')) 49 | ->shouldBeCalled() 50 | ->willReturn($menu); 51 | 52 | $factory->createItem('root') 53 | ->shouldBeCalled() 54 | ->willReturn($menu); 55 | 56 | $this->beConstructedWith($factory, $securityContext); 57 | 58 | $this->createMainMenu($request)->shouldHaveType('\Knp\Menu\ItemInterface'); 59 | } 60 | 61 | function it_builds_the_menu_when_logged_in( 62 | FactoryInterface $factory, 63 | ItemInterface $menu, 64 | Request $request, 65 | SecurityContext $securityContext, 66 | TokenInterface $token, 67 | User $user 68 | ) 69 | { 70 | $menu->setChildrenAttributes(array('class' => 'navbar-nav nav')) 71 | ->shouldBeCalled() 72 | ->willReturn($menu); 73 | 74 | $menu->addChild('nav.home', array('route' => 'quickstart_app_homepage')) 75 | ->shouldBeCalled() 76 | ->willReturn($menu); 77 | 78 | $securityContext 79 | ->isGranted('IS_AUTHENTICATED_FULLY') 80 | ->shouldBeCalled() 81 | ->willReturn(true); 82 | 83 | $securityContext 84 | ->getToken() 85 | ->shouldBeCalled() 86 | ->willReturn($token); 87 | 88 | $email = 'test@email.com'; 89 | $user 90 | ->getEmail() 91 | ->shouldBeCalled() 92 | ->willReturn($email); 93 | 94 | $token 95 | ->getUser() 96 | ->shouldBeCalled() 97 | ->willReturn($user); 98 | 99 | $menu->addChild($email, array('route' => 'quickstart_app_account')) 100 | ->shouldBeCalled() 101 | ->willReturn($menu); 102 | 103 | $menu->addChild('nav.logout', array('route' => 'fos_user_security_logout')) 104 | ->shouldBeCalled() 105 | ->willReturn($menu); 106 | 107 | $factory->createItem('root') 108 | ->shouldBeCalled() 109 | ->willReturn($menu); 110 | 111 | $this->beConstructedWith($factory, $securityContext); 112 | 113 | $this->createMainMenu($request)->shouldHaveType('\Knp\Menu\ItemInterface'); 114 | } 115 | } 116 | -------------------------------------------------------------------------------- /src/Quickstart/Bundle/AppBundle/Tests/Spec/Quickstart/Bundle/AppBundle/QuickstartAppSpec.php: -------------------------------------------------------------------------------- 1 | shouldHaveType('Quickstart\Bundle\AppBundle\QuickstartAppBundle'); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/Quickstart/Bundle/AppBundle/Tests/Spec/Quickstart/Bundle/AppBundle/Service/RandomUsernameGeneratorSpec.php: -------------------------------------------------------------------------------- 1 | shouldHaveType('Quickstart\Bundle\AppBundle\Service\RandomUsernameGenerator'); 14 | } 15 | 16 | function it_should_generate_a_string() 17 | { 18 | $this->getUsername() 19 | ->shouldBeString(); 20 | } 21 | 22 | function it_should_generate_a_unique_username_each_time() 23 | { 24 | $this->getUsername()->shouldBeUnique(); 25 | $this->getUsername()->shouldBeUnique(); 26 | $this->getUsername()->shouldBeUnique(); 27 | } 28 | 29 | public function getMatchers() 30 | { 31 | return array( 32 | 33 | 'beUnique' => function($value) 34 | { 35 | static $observedValues = array(); 36 | 37 | if (in_array($value, $observedValues)) { 38 | return false; 39 | } 40 | 41 | $observedValues[] = $value; 42 | return true; 43 | }, 44 | ); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/Quickstart/Bundle/AppBundle/Tests/Spec/Quickstart/Bundle/AppBundle/Service/VersionSpec.php: -------------------------------------------------------------------------------- 1 | beConstructedWith('version', true); 14 | } 15 | 16 | function it_is_initializable() 17 | { 18 | $this->shouldHaveType('Quickstart\Bundle\AppBundle\Service\Version'); 19 | } 20 | 21 | function it_should_get_current_version() 22 | { 23 | $this->current() 24 | ->shouldReturn('-- unknown --'); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /test/behat.yml: -------------------------------------------------------------------------------- 1 | default: 2 | suites: 3 | default: 4 | contexts: 5 | - FeatureContext: 6 | session: '@session' 7 | quickstart_app: 8 | type: symfony_bundle 9 | bundle: QuickstartAppBundle 10 | filters: 11 | tags: ~@omit 12 | extensions: 13 | Behat\Symfony2Extension: ~ 14 | Behat\MinkExtension: 15 | sessions: 16 | my_session: 17 | symfony2: ~ 18 | selenium_session: 19 | selenium2: ~ 20 | goutte_session: 21 | goutte: ~ 22 | chartinger\Behat\TwigReportExtension\Extension: 23 | output: 24 | file: test/build/report.html 25 | templates: 26 | file: default.twig 27 | phantomjs: 28 | suites: 29 | default: 30 | contexts: 31 | - FeatureContext: 32 | session: '@session' 33 | quickstart_app: 34 | type: symfony_bundle 35 | bundle: QuickstartAppBundle 36 | extensions: 37 | Behat\Symfony2Extension: ~ 38 | Behat\MinkExtension: 39 | base_url: 'http://localhost:8000' 40 | sessions: 41 | my_session: 42 | symfony2: ~ 43 | phantomjs_session: 44 | selenium2: 45 | browser: phantomjs 46 | goutte_session: 47 | goutte: ~ 48 | chartinger\Behat\TwigReportExtension\Extension: 49 | output: 50 | file: test/build/report.html 51 | templates: 52 | file: default.twig 53 | -------------------------------------------------------------------------------- /test/build/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eddiejaoude/SymfonyQuickStart/ba7f4807f1fd7a750a999de4f3f8aef22277170e/test/build/.gitkeep -------------------------------------------------------------------------------- /test/features/bootstrap/Quickstart/Bundle/AppBundle/Features/Context/FeatureContext.php: -------------------------------------------------------------------------------- 1 | getSession()->getPage(); 23 | 24 | foreach ($table->getRows() as $row) { 25 | list($fieldSelector, $value) = $row; 26 | 27 | $field = $page->findField($fieldSelector); 28 | if (empty($field)) { 29 | $field = $this->getSession()->getDriver()->find('//label[contains(normalize-space(string(.)), "' . $fieldSelector . '")]'); 30 | if (!empty($field)) { 31 | $field = current($field); 32 | } 33 | } 34 | 35 | if (empty($field)) { 36 | throw new \Exception('Field not found ' . $fieldSelector . PHP_EOL); 37 | } 38 | 39 | $tag = strtolower($field->getTagName()); 40 | 41 | if ($tag == 'textarea') { 42 | $page->fillField($fieldSelector, $value); 43 | } elseif ($tag == 'select') { 44 | if ($field->hasAttribute('multiple')) { 45 | foreach (explode(',', $value) as $index => $option) { 46 | $page->selectFieldOption($fieldSelector, trim($option), true); 47 | } 48 | } else { 49 | $page->selectFieldOption($fieldSelector, $value); 50 | } 51 | } elseif ($tag == 'input') { 52 | $type = strtolower($field->getAttribute('type')); 53 | if ($type == 'checkbox' || $type == 'radio') { 54 | if (strtolower($value) == 'yes') { 55 | $page->checkField($fieldSelector); 56 | } else { 57 | $page->uncheckField($fieldSelector); 58 | } 59 | // } elseif ($type == 'radio') { 60 | // // TODO: handle radio 61 | } else { 62 | $page->fillField($fieldSelector, $value); 63 | } 64 | } elseif ($tag == 'label') { 65 | foreach (explode(',', $value) as $option) { 66 | $option = $this->fixStepArgument(trim($option)); 67 | $field->getParent()->checkField($option); 68 | } 69 | } 70 | } 71 | } 72 | 73 | /** 74 | * @Given I am logged in as :arg1 with password :arg2 75 | */ 76 | public function iAmLoggedInAsWithPassword($email, $password) 77 | { 78 | $this->visitPath('/'); 79 | $this->getSession()->getPage()->clickLink('Login'); 80 | $this->getSession()->getPage()->fillField('username', $email); 81 | $this->getSession()->getPage()->fillField('password', $password); 82 | $this->getSession()->getPage()->pressButton('_submit'); 83 | } 84 | 85 | /** 86 | * @Given following users for each persona exist on system: 87 | */ 88 | public function followingUsersForEachPersonaExistOnSystem(TableNode $table) 89 | { 90 | 91 | } 92 | } 93 | -------------------------------------------------------------------------------- /test/phpspec.yml: -------------------------------------------------------------------------------- 1 | suites: 2 | default: 3 | namespace: Quickstart\Bundle\AppBundle 4 | spec_prefix: Spec 5 | spec_path: src/Quickstart/Bundle/AppBundle/Tests 6 | 7 | extensions: 8 | - PhpSpec\Extension\CodeCoverageExtension 9 | 10 | code_coverage: 11 | whitelist: 12 | - src/Quickstart/Bundle/AppBundle/DependencyInjection 13 | - src/Quickstart/Bundle/AppBundle/EventListener 14 | - src/Quickstart/Bundle/AppBundle/Menu 15 | - src/Quickstart/Bundle/AppBundle/Service 16 | whitelist_files: 17 | - src/Quickstart/Bundle/AppBundle/QuickstartAppBundle.php 18 | format: 19 | - html 20 | - clover 21 | output: 22 | html: test/build/coverage 23 | clover: test/build/coverage.xml 24 | -------------------------------------------------------------------------------- /version: -------------------------------------------------------------------------------- 1 | -- unknown -- -------------------------------------------------------------------------------- /web/.htaccess: -------------------------------------------------------------------------------- 1 | # Use the front controller as index file. It serves as a fallback solution when 2 | # every other rewrite/redirect fails (e.g. in an aliased environment without 3 | # mod_rewrite). Additionally, this reduces the matching process for the 4 | # start page (path "/") because otherwise Apache will apply the rewriting rules 5 | # to each configured DirectoryIndex file (e.g. index.php, index.html, index.pl). 6 | DirectoryIndex app.php 7 | 8 | 9 | RewriteEngine On 10 | 11 | # Determine the RewriteBase automatically and set it as environment variable. 12 | # If you are using Apache aliases to do mass virtual hosting or installed the 13 | # project in a subdirectory, the base path will be prepended to allow proper 14 | # resolution of the app.php file and to redirect to the correct URI. It will 15 | # work in environments without path prefix as well, providing a safe, one-size 16 | # fits all solution. But as you do not need it in this case, you can comment 17 | # the following 2 lines to eliminate the overhead. 18 | RewriteCond %{REQUEST_URI}::$1 ^(/.+)/(.*)::\2$ 19 | RewriteRule ^(.*) - [E=BASE:%1] 20 | 21 | # Sets the HTTP_AUTHORIZATION header removed by apache 22 | RewriteCond %{HTTP:Authorization} . 23 | RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}] 24 | 25 | # Redirect to URI without front controller to prevent duplicate content 26 | # (with and without `/app.php`). Only do this redirect on the initial 27 | # rewrite by Apache and not on subsequent cycles. Otherwise we would get an 28 | # endless redirect loop (request -> rewrite to front controller -> 29 | # redirect -> request -> ...). 30 | # So in case you get a "too many redirects" error or you always get redirected 31 | # to the start page because your Apache does not expose the REDIRECT_STATUS 32 | # environment variable, you have 2 choices: 33 | # - disable this feature by commenting the following 2 lines or 34 | # - use Apache >= 2.3.9 and replace all L flags by END flags and remove the 35 | # following RewriteCond (best solution) 36 | RewriteCond %{ENV:REDIRECT_STATUS} ^$ 37 | RewriteRule ^app\.php(/(.*)|$) %{ENV:BASE}/$2 [R=301,L] 38 | 39 | # If the requested filename exists, simply serve it. 40 | # We only want to let Apache serve files and not directories. 41 | RewriteCond %{REQUEST_FILENAME} -f 42 | RewriteRule .? - [L] 43 | 44 | # Rewrite all other queries to the front controller. 45 | RewriteRule .? %{ENV:BASE}/app.php [L] 46 | 47 | 48 | 49 | 50 | # When mod_rewrite is not available, we instruct a temporary redirect of 51 | # the start page to the front controller explicitly so that the website 52 | # and the generated links can still be used. 53 | RedirectMatch 302 ^/$ /app.php/ 54 | # RedirectTemp cannot be used instead 55 | 56 | 57 | -------------------------------------------------------------------------------- /web/app.php: -------------------------------------------------------------------------------- 1 | unregister(); 14 | $apcLoader->register(true); 15 | */ 16 | 17 | require_once __DIR__.'/../app/AppKernel.php'; 18 | //require_once __DIR__.'/../app/AppCache.php'; 19 | 20 | $kernel = new AppKernel('prod', false); 21 | $kernel->loadClassCache(); 22 | //$kernel = new AppCache($kernel); 23 | 24 | // When using the HttpCache, you need to call the method in your front controller instead of relying on the configuration parameter 25 | //Request::enableHttpMethodParameterOverride(); 26 | $request = Request::createFromGlobals(); 27 | $response = $kernel->handle($request); 28 | $response->send(); 29 | $kernel->terminate($request, $response); 30 | -------------------------------------------------------------------------------- /web/app_dev.php: -------------------------------------------------------------------------------- 1 | loadClassCache(); 27 | $request = Request::createFromGlobals(); 28 | $response = $kernel->handle($request); 29 | $response->send(); 30 | $kernel->terminate($request, $response); 31 | -------------------------------------------------------------------------------- /web/apple-touch-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eddiejaoude/SymfonyQuickStart/ba7f4807f1fd7a750a999de4f3f8aef22277170e/web/apple-touch-icon.png -------------------------------------------------------------------------------- /web/config.php: -------------------------------------------------------------------------------- 1 | getFailedRequirements(); 20 | $minorProblems = $symfonyRequirements->getFailedRecommendations(); 21 | 22 | ?> 23 | 24 | 25 | 26 | 27 | 28 | Symfony Configuration 29 | 30 | 31 | 32 | 33 | 34 |
35 |
36 | 39 | 40 | 60 |
61 | 62 |
63 |
64 |
65 |

Welcome!

66 |

Welcome to your new Symfony project.

67 |

68 | This script will guide you through the basic configuration of your project. 69 | You can also do the same by editing the ‘app/config/parameters.yml’ file directly. 70 |

71 | 72 | 73 |

Major problems

74 |

Major problems have been detected and must be fixed before continuing:

75 |
    76 | 77 |
  1. getHelpHtml() ?>
  2. 78 | 79 |
80 | 81 | 82 | 83 |

Recommendations

84 |

85 | Additionally, toTo enhance your Symfony experience, 86 | it’s recommended that you fix the following: 87 |

88 |
    89 | 90 |
  1. getHelpHtml() ?>
  2. 91 | 92 |
93 | 94 | 95 | hasPhpIniConfigIssue()): ?> 96 |

* 97 | getPhpIniConfigPath()): ?> 98 | Changes to the php.ini file must be done in "getPhpIniConfigPath() ?>". 99 | 100 | To change settings, create a "php.ini". 101 | 102 |

103 | 104 | 105 | 106 |

Your configuration looks good to run Symfony.

107 | 108 | 109 | 118 |
119 |
120 |
121 |
Symfony Standard Edition
122 |
123 | 124 | 125 | -------------------------------------------------------------------------------- /web/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eddiejaoude/SymfonyQuickStart/ba7f4807f1fd7a750a999de4f3f8aef22277170e/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 | --------------------------------------------------------------------------------