├── .gitignore ├── .lin3s_cs.yml.dist ├── Capfile ├── Gemfile ├── Gemfile.lock ├── README.md ├── app ├── .htaccess.dist ├── AppCache.php ├── AppKernel.php ├── Resources │ ├── TwigBundle │ │ └── views │ │ │ └── Exception │ │ │ ├── error.html.twig │ │ │ ├── error403.html.twig │ │ │ └── error404.html.twig │ ├── assets │ │ ├── js │ │ │ └── app.js │ │ └── scss │ │ │ ├── app.scss │ │ │ ├── base │ │ │ ├── _colors.scss │ │ │ ├── _common.scss │ │ │ ├── _reset.scss │ │ │ └── _typography.scss │ │ │ ├── components │ │ │ ├── _button.scss │ │ │ └── _deprecation-notice.scss │ │ │ ├── layout │ │ │ ├── _content.scss │ │ │ ├── _footer.scss │ │ │ └── _header.scss │ │ │ └── pages │ │ │ ├── _404.scss │ │ │ ├── _default.scss │ │ │ └── _home.scss │ └── views │ │ ├── base.html.twig │ │ ├── component │ │ ├── cookies.html.twig │ │ └── deprecation_notice.html.twig │ │ └── default │ │ └── index.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 │ ├── routing.yml │ ├── routing_dev.yml │ └── security.yml ├── console ├── logs │ └── .gitkeep ├── migrations │ └── Version20150914111050.php └── sessions │ └── .gitkeep ├── composer.json ├── deploy ├── deploy.rb ├── stages │ └── dev1.rb └── tasks │ ├── cache_clear.cap │ ├── compile_upload.cap │ ├── database_download.cap │ ├── database_migrations.cap │ ├── git_check_branch.cap │ └── server_ensure.cap ├── gulpfile.js ├── package.json ├── src ├── .htaccess.dist ├── AppBundle │ ├── AppBundle.php │ ├── Controller │ │ └── DefaultController.php │ ├── DependencyInjection │ │ └── AppExtension.php │ └── Resources │ │ └── config │ │ ├── admin.yml │ │ └── services.yml └── Application │ └── Sonata │ └── UserBundle │ ├── Admin │ └── UserAdmin.php │ ├── ApplicationSonataUserBundle.php │ ├── DataFixtures │ └── ORM │ │ └── LoadUserData.php │ ├── Document │ ├── Group.php │ └── User.php │ ├── Entity │ ├── Group.php │ └── User.php │ └── Resources │ └── config │ ├── doctrine │ ├── Group.mongodb.yml │ ├── Group.orm.yml │ ├── User.mongodb.yml │ └── User.orm.yml │ └── serializer │ ├── Document.Group.yml │ ├── Document.User.yml │ ├── Entity.Group.yml │ └── Entity.User.yml └── web ├── .htaccess.dist ├── app.php ├── app_dev.php ├── apple-touch-icon.png ├── favicon.ico └── robots.txt /.gitignore: -------------------------------------------------------------------------------- 1 | # This file is part of the Symfony Standard project. 2 | # 3 | # Copyright (c) 2016 LIN3S 4 | # 5 | # For the full copyright and license information, please view the LICENSE 6 | # file that was distributed with this source code. 7 | # 8 | # @author Jon Torrado 9 | # @author Beñat Espiña 10 | 11 | #### Symfony #### 12 | /app/cache/* 13 | /app/logs/* 14 | /app/sessions/* 15 | !app/cache/.gitkeep 16 | !app/logs/.gitkeep 17 | !app/sessions/.gitkeep 18 | /var/cache/* 19 | /var/logs/* 20 | /var/sessions/* 21 | !var/cache/.gitkeep 22 | !var/logs/.gitkeep 23 | !var/sessions/.gitkeep 24 | /app/config/parameters.yml 25 | /app/config/parameters.ini 26 | /app/bootstrap.php.cache 27 | /var/bootstrap.php.cache 28 | /bin/* 29 | !bin/console 30 | !bin/symfony_requirements 31 | /vendor 32 | /web/bundles 33 | /web/svg 34 | /web/uploads 35 | /build 36 | /web/css 37 | /web/js 38 | 39 | #### CAPISTRANO #### 40 | /log 41 | 42 | #### LIN3S #### 43 | .editorconfig 44 | .eslint.yml 45 | .lin3s_cs.yml 46 | .scss_lint.yml 47 | 48 | #### Node.js #### 49 | /node_modules 50 | 51 | #### Composer #### 52 | /composer.phar 53 | -------------------------------------------------------------------------------- /.lin3s_cs.yml.dist: -------------------------------------------------------------------------------- 1 | # This file is part of the Symfony Standard project. 2 | # 3 | # Copyright (c) 2016 LIN3S 4 | # 5 | # For the full copyright and license information, please view the LICENSE 6 | # file that was distributed with this source code. 7 | # 8 | # @author Beñat Espiña 9 | 10 | parameters: 11 | enabled: 12 | - phpmd 13 | - phpformatter 14 | - phpcsfixer 15 | - scsslint 16 | - eslint 17 | 18 | name: Symfony Standard 19 | type: project 20 | year: 2016 21 | author: LIN3S 22 | email: info@lin3s.com 23 | version: 0.1 24 | 25 | phpmd_path: src 26 | phpmd_rules: 27 | - controversial 28 | - unusedcode 29 | - codesize 30 | - naming 31 | 32 | phpformatter_path: src 33 | 34 | phpcsfixer_path: src 35 | phpcsfixer_level: symfony # can be psr0, psr1, psr2 or symfony 36 | phpcsfixer_fixers: 37 | - -unalign_double_arrow 38 | - -concat_without_spaces 39 | 40 | - align_double_arrow 41 | - concat_with_spaces 42 | - multiline_spaces_before_semicolon 43 | - newline_after_open_tag 44 | - ordered_use 45 | - php4_constructor 46 | - phpdoc_order 47 | - phpdoc_var_to_type 48 | - short_array_syntax 49 | - short_echo_tag 50 | - strict 51 | - strict_param 52 | 53 | scsslint_path: app/Resources/assets/scss 54 | scsslint_file_location: . 55 | scsslint_exclude: 56 | - base/_reset.scss 57 | scsslint_rules: # available rules can view for https://github.com/brigade/scss-lint/blob/master/config/default.yml 58 | linters: 59 | SelectorFormat: 60 | enabled: true 61 | convention: hyphenated_BEM 62 | eslint_path: app/Resources/assets/js 63 | eslint_file_location: . 64 | eslint_exclude: 65 | - cookies.js 66 | eslint_rules: # available rules can view in http://eslint.org/docs/rules/ 67 | ecmaFeatures: [] 68 | env: 69 | browser: true 70 | jquery: true 71 | globals: 72 | dataLayer: true 73 | FastClick: true 74 | Modernizr: true 75 | svg4everybody: true 76 | rules: 77 | max-len: 78 | - 2 79 | - 120 80 | -------------------------------------------------------------------------------- /Capfile: -------------------------------------------------------------------------------- 1 | # This file is part of the Symfony Standard project. 2 | # 3 | # Copyright (c) 2016 LIN3S 4 | # 5 | # For the full copyright and license information, please view the LICENSE 6 | # file that was distributed with this source code. 7 | # 8 | # @author Gorka Laucirica 9 | # @author Jon Torrado 10 | # @author Beñat Espiña 11 | 12 | set :deploy_config_path, 'deploy/deploy.rb' 13 | set :stage_config_path, 'deploy/stages/' 14 | 15 | # Load DSL and Setup Up Stages 16 | require 'capistrano/setup' 17 | 18 | # Includes default deployment tasks 19 | require 'capistrano/deploy' 20 | require 'capistrano/symfony' 21 | 22 | # Override the default path to bundle deployments scripts and tasks 23 | Dir.glob('deploy/tasks/*.cap').each { |r| import r } 24 | -------------------------------------------------------------------------------- /Gemfile: -------------------------------------------------------------------------------- 1 | # This file is part of the Symfony Standard project. 2 | # 3 | # Copyright (c) 2016 LIN3S 4 | # 5 | # For the full copyright and license information, please view the LICENSE 6 | # file that was distributed with this source code. 7 | # 8 | # @author Jon Torrado 9 | # @author Beñat Espiña 10 | 11 | source 'https://rubygems.org' 12 | 13 | gem 'capistrano-symfony', '~> 0.4.0' 14 | gem 'scss_lint', '~> 0.48.0' 15 | gem 'windows-pr' if RUBY_PLATFORM =~ /win32/i || RUBY_PLATFORM =~ /mingw32/i 16 | gem 'win32console' if RUBY_PLATFORM =~ /win32/i || RUBY_PLATFORM =~ /mingw32/i 17 | -------------------------------------------------------------------------------- /Gemfile.lock: -------------------------------------------------------------------------------- 1 | GEM 2 | remote: https://rubygems.org/ 3 | specs: 4 | capistrano (3.4.0) 5 | i18n 6 | rake (>= 10.0.0) 7 | sshkit (~> 1.3) 8 | capistrano-composer (0.0.6) 9 | capistrano (>= 3.0.0.pre) 10 | capistrano-file-permissions (0.1.1) 11 | capistrano (~> 3.1) 12 | capistrano-symfony (0.4.0) 13 | capistrano (~> 3.1) 14 | capistrano-composer (~> 0.0.3) 15 | capistrano-file-permissions (~> 0.1.0) 16 | colorize (0.7.7) 17 | i18n (0.7.0) 18 | net-scp (1.2.1) 19 | net-ssh (>= 2.6.5) 20 | net-ssh (2.9.2) 21 | rainbow (2.0.0) 22 | rake (10.4.2) 23 | sass (3.4.19) 24 | scss_lint (0.42.2) 25 | rainbow (~> 2.0) 26 | sass (~> 3.4.15) 27 | sshkit (1.7.1) 28 | colorize (>= 0.7.0) 29 | net-scp (>= 1.1.2) 30 | net-ssh (>= 2.8.0) 31 | 32 | PLATFORMS 33 | ruby 34 | 35 | DEPENDENCIES 36 | capistrano (~> 3.1) 37 | capistrano-symfony (~> 0.4) 38 | sass (~> 3.4, >= 3.4.19) 39 | scss_lint (~> 0.42.2) 40 | 41 | BUNDLED WITH 42 | 1.10.6 43 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Symfony Standard 2 | > The "Symfony Standard" distribution in the LIN3S way. 3 | 4 | [![SensioLabsInsight](https://insight.sensiolabs.com/projects/00c67aae-3f52-419b-93df-751050299dcb/mini.png)](https://insight.sensiolabs.com/projects/00c67aae-3f52-419b-93df-751050299dcb) 5 | [![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/LIN3S/SymfonyStandard/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/LIN3S/SymfonyStandard/?branch=master) 6 | [![Total Downloads](https://poser.pugx.org/lin3s/symfony-standard/downloads)](https://packagist.org/packages/lin3s/symfony-standard) 7 |      8 | [![Latest Stable Version](https://poser.pugx.org/lin3s/symfony-standard/v/stable.svg)](https://packagist.org/packages/lin3s/symfony-standard) 9 | [![Latest Unstable Version](https://poser.pugx.org/lin3s/symfony-standard/v/unstable.svg)](https://packagist.org/packages/lin3s/symfony-standard) 10 | 11 | ## Why? 12 | [**Symfony**][1] is a set of reusable PHP components and a PHP framework for web projects. In [*LIN3S*][2] we implement 13 | this solution providing some useful features that the standard edition of Symfony doesn't come with: 14 | 15 | 1. [SonataAdminBundle][3] 16 | 2. [SonataUserBundle][4] 17 | * Dependencies not included in this file. 18 | 3. [Doctrine Migrations][5] 19 | 3. [LiipImagineBundle][6] 20 | 4. [StofDoctrineExtensions][7] 21 | 5. Front-end workflow 22 | * [Sass][8] 23 | * [Npm][9] 24 | * [Gulp.js][10] 25 | 6. [Capistrano][11] deploy 26 | 7. A complete base.html.twig based on [HTML5 Boilerplate][12] 27 | 8. As dev dependency, [Doctrine Fixtures][13] 28 | 9. [Coding standards library][14] made by LIN3S 29 | 30 | ## Prerequisites 31 | The above sounds great so, now, to start developing with our Symfony Standard, you need to meet the following 32 | requirements: 33 | 34 | 1. [PHP][15] 5.4 or higher 35 | 2. [MySQL][16] or [MongoDB][178] 36 | 3. [Composer][18]: `curl -sS https://getcomposer.org/installer | php` 37 | 4. [Ruby][19] 38 | * Bundler: `gem install bundler` 39 | * After bundler: `bundle install` (see Gemfile) 40 | 5. [Node.js][20] 4.0 or higher 41 | * Gulp.js: `npm install -g gulp` 42 | * ESLint: `npm install -g eslint` 43 | 44 | ## Getting Started 45 | After installing all the prerequisites, to create a Symfony project based on this *Symfony Standard*, you should 46 | follow these steps. 47 | 48 | Firstly, you need to **create the project**: 49 | ``` 50 | $ composer create-project lin3s/symfony-standard && cd 51 | ``` 52 | 53 | > If your `app/config/parameters.yml` file was not created right after finishing the composer process, the system 54 | will ask you some questions in order to create the needed file. If you want to create it by hand, just copy the 55 | *app/config/parameters.yml.dist* file: 56 | `$ cp app/config/parameters.yml.dist app/config/parameters.yml` 57 | 58 | > If the process fails as soon as it finishes, it's because the database is not created yet. Run 59 | `php app/console doctrine:database:create` in order to create it and then create the needed tables with 60 | `php app/console doctrine:migrations:migrate` command. 61 | 62 | After that, *if you use a Web server*, you should visit the [Symfony permissions section][21] of the installation 63 | documentation so your CLI user and Web server user are allowed to write **cache**, **logs** and *sessions** folders. 64 | You may use these commands: 65 | ``` 66 | $ rm -rf app/cache/* 67 | $ rm -rf app/logs/* 68 | $ rm -rf app/sessions/* 69 | 70 | $ HTTPDUSER=`ps axo user,comm | grep -E '[a]pache|[h]ttpd|[_]www|[w]ww-data|[n]ginx' | grep -v root | head -1 | cut -d\ -f1` 71 | $ sudo chmod +a "$HTTPDUSER allow delete,write,append,file_inherit,directory_inherit" app/cache app/logs app/sessions 72 | $ sudo chmod +a "`whoami` allow delete,write,append,file_inherit,directory_inherit" app/cache app/logs app/sessions 73 | ``` 74 | 75 | Also, if you are using Apache Web server, consider renaming `.htaccess.dist` files located within the `app`, `src` and 76 | `web` folders to `.htaccess` or create the proper server configuration to improve global performances. 77 | 78 | If you are willing to use LiipImagineBundle, create the needed folder: 79 | ``` 80 | $ mkdir -p web/media/cache 81 | ``` 82 | 83 | You can modify this path editing the `cache` parameter in the `liip_imagine` section within the `app/config/config.yml` 84 | file. Also remember to give this folder the right permissions so the web server is allowed to write. 85 | 86 | If you want to load some default users, run the following command in order to create an *admin/admin* account and 50 87 | fake users: 88 | ``` 89 | $ php app/console doctrine:fixtures:load 90 | ``` 91 | 92 | Also, if you want to create an admin user by hand, follow these steps: 93 | ``` 94 | $ php app/console fos:user:create 95 | $ php app/console fos:user:promote --> give the ROLE_SUPER_ADMIN permission 96 | ``` 97 | 98 | In order to use the built-in server, use the following command: 99 | ``` 100 | $ php app/console server:run 101 | ``` 102 | 103 | Access to your admin panel by going to `/admin` 104 | 105 | A complete `app/Resources/views/base.html.twig` file is provided by default. Be sure to modify this file and override 106 | the meta blocks whenever it's needed. Commented out you can find usefull examples with the full information links and 107 | validators. 108 | 109 | We improved the production logs managed by [*monolog*][22]. Edit `app/config/config_prod.yml` so it suits your needs. 110 | 111 | If you are planning to add some tests, be sure to edit your composer.json `autoload` section with something like this: 112 | ``` 113 | "autoload": { 114 | "psr-4": { "": "src/" }, 115 | "classmap": [ "app/AppKernel.php", "app/AppCache.php" ], 116 | "exclude-from-classmap": [ "/Tests/", "/test/", "/tests/" ] 117 | }, 118 | ``` 119 | 120 | Also, if your development IDE is [PhpStorm][23], uncomment the following line in `app/config/config.yml`: 121 | ``` 122 | framework: 123 | ide: "phpstorm://open?file=%%f&line=%%l" 124 | ``` 125 | 126 | ## Front-end workflow 127 | First of all, download all the dependencies needed for Ruby and Node.js: 128 | ``` 129 | $ bundle install 130 | $ npm install 131 | ``` 132 | 133 | Feel free to add and/or edit the npm dependencies by editing the `package.json` file. 134 | 135 | After this initial step, you will have the following gulp tasks available: 136 | * `gulp sass`: compiles `app/Resources/assets/scss/app.scss` and moves the resulting file to `web/` folder. 137 | * `gulp sass:prod`: compiles and minifies `app/Resources/assets/scss/app.scss` and moves the resulting file to `web/` folder. 138 | * `gulp scss-lint`: it helps you to keep your SCSS files clean and readable. 139 | * `gulp modernizr`: creates a `modernizr.js` file with the selected tests. 140 | * `gulp js`: copies the JS files to the `web/js` folder to work in the dev environment. 141 | * `gulp js:prod`: combines and minifies the needed JS files, including `modernizr.js`. 142 | * `gulp sprites`: creates a SVG sprite. 143 | * `gulp watch`: checks SCSS, JS and SVG changes to launch the corresponding task. 144 | * `gulp default`: executes sass, js:prod, sprites and starts watching. 145 | * `gulp prod`: executes sass:prod, modernizr, js:prod and spritest tasks. 146 | 147 | As you see, you should create and/or edit .scss files within the `app/Resources/assets/scss/` folder. An initial 148 | structure is already given for you. You can also add/or edit .js files, but **remember** to modify `gulpfile.js` 149 | `jsFiles` variable in order to add what your project needs, adding the new files to `base.html.twig` too. 150 | 151 | Also, `livereload` is up and running when launching `gulp watch`. You should install the correct browser extension and 152 | be sure to navigate through the dev environment. 153 | 154 | ## Doctrine Extensions 155 | This bundle is installed by default. You just have to enable what your project needs, for example: 156 | ``` 157 | stof_doctrine_extensions: 158 | orm: 159 | default: 160 | sluggable: true 161 | timestampable: true 162 | ``` 163 | 164 | Some extensions do need an extra configuration in the `doctrine` section of the `app/config/config.yml` file. Check 165 | the full configuration [here][24]. 166 | 167 | For the other possible configurations, visit the [bundle documentation][7] 168 | 169 | ## Doctrine Migrations 170 | Capistrano will run the needed migrations when running a deployment. You just need to generate the correct files within 171 | the `app/migrations` folder. In order to do so, just run `php app/console doctrine:migrations:diff` and push the 172 | generated file to your SCM before runnning the deploy. 173 | 174 | For other possible configurations, visit the [bundle documentation][5] 175 | 176 | ## Deployment 177 | To automatize the deployment process this project is using **Capistrano** with **capistrano-symfony** plugin. You can 178 | find the whole configuration within the `deploy` directory. Customize deploy tasks modifying the `deploy/deploy.rb` file. 179 | 180 | You should update the *symfony-standard* application name for your awesome project name and the repo url with your 181 | Git project url. 182 | 183 | Inside `deploy/stages` directory there are two files that can be considered as pre-production stage and production stage. 184 | There is no logic, these files only contain few parameters that you should customize for your proper deployment. 185 | 186 | After all, and following the Capistrano [documentation][11] to configure the server, you can deploy executing: 187 | ``` 188 | $ cap deploy # can be dev1, prod or whatever file inside stages directory 189 | ``` 190 | 191 | > In the Capistrano shared directory you should create the `app/config/parameters.yml` file, `app/logs`, `app/sessions` 192 | and `web/uploads` folder should be created for you. 193 | 194 | ###Clearing remote caches 195 | 196 | When working with PHP7 & Opcache, for example, you won't see all changes after deploying. Caches need to be flushed 197 | with the correct website domain. If you need this feature, just open the `deploy.rb` file and remove the commented line: 198 | 199 | ``` 200 | #after :finishing, 'cache:clear' 201 | ``` 202 | 203 | This is done by [Smart-Core/AcceleratorCacheBundle][25]. If you need different configurations for your deployment 204 | stages, feel free to create a variable and add the required parameters to the `stages/*.rb` files. 205 | 206 | [1]: http://symfony.com/ 207 | [2]: http://www.lin3s.com/ 208 | [3]: https://sonata-project.org/bundles/admin 209 | [4]: https://sonata-project.org/bundles/user 210 | [5]: http://symfony.com/doc/current/bundles/DoctrineMigrationsBundle/index.html 211 | [6]: https://github.com/liip/LiipImagineBundle 212 | [7]: https://github.com/stof/StofDoctrineExtensionsBundle/blob/master/Resources/doc/index.rst 213 | [8]: http://sass-lang.com/ 214 | [9]: https://www.npmjs.com/ 215 | [10]: http://gulpjs.com/ 216 | [11]: http://capistranorb.com/ 217 | [12]: https://html5boilerplate.com/ 218 | [13]: http://symfony.com/doc/current/bundles/DoctrineFixturesBundle/index.html 219 | [14]: https://github.com/LIN3S/CS 220 | [15]: http://php.net 221 | [16]: http://dev.mysql.com/downloads/ 222 | [17]: https://www.mongodb.org/ 223 | [18]: https://getcomposer.org/ 224 | [19]: https://www.ruby-lang.org/en/downloads/ 225 | [20]: https://nodejs.org/download/ 226 | [21]: http://symfony.com/doc/2.8/book/installation.html#book-installation-permissions 227 | [22]: http://symfony.com/doc/master/cookbook/logging/monolog.html 228 | [23]: https://www.jetbrains.com/phpstorm/ 229 | [24]: https://github.com/stof/StofDoctrineExtensionsBundle/blob/master/Resources/doc/index.rst#step-3-add-the-extensions-to-your-mapping 230 | [25]: https://github.com/Smart-Core/AcceleratorCacheBundle 231 | -------------------------------------------------------------------------------- /app/.htaccess.dist: -------------------------------------------------------------------------------- 1 | 2 | Require all denied 3 | 4 | 5 | Order deny,allow 6 | Deny from all 7 | 8 | -------------------------------------------------------------------------------- /app/AppCache.php: -------------------------------------------------------------------------------- 1 | 11 | * @author Beñat Espiña 12 | */ 13 | class AppCache extends HttpCache 14 | { 15 | } 16 | -------------------------------------------------------------------------------- /app/AppKernel.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 | use Symfony\Component\HttpKernel\Kernel; 13 | use Symfony\Component\Config\Loader\LoaderInterface; 14 | 15 | /** 16 | * Symfony's kernel class. 17 | * 18 | * @author Jon Torrado 19 | * @author Beñat Espiña 20 | */ 21 | class AppKernel extends Kernel 22 | { 23 | /** 24 | * {@inheritdoc} 25 | */ 26 | public function registerBundles() 27 | { 28 | $bundles = [ 29 | new Symfony\Bundle\FrameworkBundle\FrameworkBundle(), 30 | new Symfony\Bundle\SecurityBundle\SecurityBundle(), 31 | new Symfony\Bundle\TwigBundle\TwigBundle(), 32 | new Symfony\Bundle\MonologBundle\MonologBundle(), 33 | new Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle(), 34 | new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(), 35 | new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(), 36 | 37 | new Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle(), 38 | new FOS\UserBundle\FOSUserBundle(), 39 | new Liip\ImagineBundle\LiipImagineBundle(), 40 | new SmartCore\Bundle\AcceleratorCacheBundle\AcceleratorCacheBundle(), 41 | new Stof\DoctrineExtensionsBundle\StofDoctrineExtensionsBundle(), 42 | 43 | new Knp\Bundle\MenuBundle\KnpMenuBundle(), 44 | new Sonata\CoreBundle\SonataCoreBundle(), 45 | new Sonata\BlockBundle\SonataBlockBundle(), 46 | new Sonata\DoctrineORMAdminBundle\SonataDoctrineORMAdminBundle(), 47 | new Sonata\AdminBundle\SonataAdminBundle(), 48 | new Sonata\EasyExtendsBundle\SonataEasyExtendsBundle(), 49 | new Sonata\UserBundle\SonataUserBundle('FOSUserBundle'), 50 | new Application\Sonata\UserBundle\ApplicationSonataUserBundle(), 51 | 52 | new AppBundle\AppBundle(), 53 | ]; 54 | 55 | if (in_array($this->getEnvironment(), ['dev', 'test'])) { 56 | $bundles[] = new Doctrine\Bundle\FixturesBundle\DoctrineFixturesBundle(); 57 | $bundles[] = new Symfony\Bundle\DebugBundle\DebugBundle(); 58 | $bundles[] = new Symfony\Bundle\WebProfilerBundle\WebProfilerBundle(); 59 | $bundles[] = new Sensio\Bundle\DistributionBundle\SensioDistributionBundle(); 60 | $bundles[] = new Sensio\Bundle\GeneratorBundle\SensioGeneratorBundle(); 61 | } 62 | 63 | return $bundles; 64 | } 65 | 66 | /** 67 | * {@inheritdoc} 68 | */ 69 | public function registerContainerConfiguration(LoaderInterface $loader) 70 | { 71 | $loader->load($this->getRootDir() . '/config/config_' . $this->getEnvironment() . '.yml'); 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /app/Resources/TwigBundle/views/Exception/error.html.twig: -------------------------------------------------------------------------------- 1 | {# app/Resources/TwigBundle/views/Exception/error.html.twig #} 2 | {% extends 'base.html.twig' %} 3 | 4 | {% block body %} 5 |

Internal Server Error

6 | 7 | {# example security usage, see below #} 8 | {% if app.user and is_granted('IS_AUTHENTICATED_FULLY') %} 9 | {# ... #} 10 | {% endif %} 11 | 12 |

13 | The server encountered an internal error or misconfiguration and was 14 | unable to complete your request. Please contact the administrator and 15 | inform them of the time the error occurred, and anything you might have 16 | done that may have caused the error. 17 |

18 | {% endblock %} 19 | -------------------------------------------------------------------------------- /app/Resources/TwigBundle/views/Exception/error403.html.twig: -------------------------------------------------------------------------------- 1 | {# app/Resources/TwigBundle/views/Exception/error403.html.twig #} 2 | {% extends 'base.html.twig' %} 3 | 4 | {% block body %} 5 |

Permission denied

6 | 7 | {# example security usage, see below #} 8 | {% if app.user and is_granted('IS_AUTHENTICATED_FULLY') %} 9 | {# ... #} 10 | {% endif %} 11 | 12 |

13 | You do not have permission to retrieve the URL or link you requested. 14 | Please inform the administrator of the referring page if you think this 15 | was a mistake. 16 |

17 | {% endblock %} 18 | -------------------------------------------------------------------------------- /app/Resources/TwigBundle/views/Exception/error404.html.twig: -------------------------------------------------------------------------------- 1 | {# app/Resources/TwigBundle/views/Exception/error404.html.twig #} 2 | {% extends 'base.html.twig' %} 3 | 4 | {% block body %} 5 |

Page not found

6 | 7 | {# example security usage, see below #} 8 | {% if app.user and is_granted('IS_AUTHENTICATED_FULLY') %} 9 | {# ... #} 10 | {% endif %} 11 | 12 |

13 | The requested page couldn't be located. Checkout for any URL 14 | misspelling or return to the homepage. 15 |

16 | {% endblock %} 17 | -------------------------------------------------------------------------------- /app/Resources/assets/js/app.js: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the Symfony Standard project. 3 | * 4 | * Copyright (c) 2016 LIN3S 5 | * 6 | * For the full copyright and license information, please view the LICENSE 7 | * file that was distributed with this source code. 8 | * 9 | * @author Beñat Espiña 10 | */ 11 | 12 | 'use strict'; 13 | 14 | (function () { 15 | 16 | if ('addEventListener' in document) { 17 | document.addEventListener('DOMContentLoaded', function () { 18 | 19 | FastClick.attach(document.body); 20 | 21 | svg4everybody(); 22 | 23 | new BenGorCookies({ 24 | links: 'a, button, .bengor-cookies__actions, .bengor-cookies__button', 25 | maxPageYOffset: 500, 26 | GTMId: 'undefined' 27 | }); 28 | }, false); 29 | } 30 | 31 | })(); 32 | -------------------------------------------------------------------------------- /app/Resources/assets/scss/app.scss: -------------------------------------------------------------------------------- 1 | // This file is part of the Symfony Standard project. 2 | // 3 | // Copyright (c) 2016 LIN3S 4 | // 5 | // For the full copyright and license information, please view the LICENSE 6 | // file that was distributed with this source code. 7 | // 8 | // @author Jon Torrado 9 | 10 | @import 'base/reset'; 11 | @import 'base/colors'; 12 | @import 'base/typography'; 13 | 14 | // Imports for using Zurb Foundation 15 | @import '../../../../node_modules/foundation-sites/scss/util/util'; 16 | @import '../../../../node_modules/foundation-sites/scss/global'; 17 | @import '../../../../node_modules/foundation-sites/scss/grid/grid'; 18 | @import '../../../../node_modules/foundation-sites/scss/components/flex'; 19 | @include foundation-global-styles; 20 | @include foundation-flex-classes; 21 | @include foundation-flex-grid; 22 | 23 | @import '../../../../node_modules/bengor-cookies/src/scss/bengor-cookies'; 24 | 25 | @import 'base/common'; 26 | 27 | @import 'layout/header'; 28 | @import 'layout/content'; 29 | @import 'layout/footer'; 30 | 31 | //@import 'components/button'; 32 | @import 'components/deprecation-notice'; 33 | 34 | //@import 'pages/default'; 35 | //@import 'pages/home'; 36 | //@import 'pages/404'; 37 | -------------------------------------------------------------------------------- /app/Resources/assets/scss/base/_colors.scss: -------------------------------------------------------------------------------- 1 | // This file is part of the Symfony Standard project. 2 | // 3 | // Copyright (c) 2016 LIN3S 4 | // 5 | // For the full copyright and license information, please view the LICENSE 6 | // file that was distributed with this source code. 7 | // 8 | // @author Gorka Laucirica 9 | 10 | $white: #fff; 11 | $lightest-grey: #f0f0f0; 12 | $black: #000; 13 | -------------------------------------------------------------------------------- /app/Resources/assets/scss/base/_common.scss: -------------------------------------------------------------------------------- 1 | // This file is part of the Symfony Standard project. 2 | // 3 | // Copyright (c) 2016 LIN3S 4 | // 5 | // For the full copyright and license information, please view the LICENSE 6 | // file that was distributed with this source code. 7 | // 8 | // @author Gorka Laucirica 9 | -------------------------------------------------------------------------------- /app/Resources/assets/scss/base/_reset.scss: -------------------------------------------------------------------------------- 1 | // This file is part of the Symfony Standard project. 2 | // 3 | // Copyright (c) 2016 LIN3S 4 | // 5 | // For the full copyright and license information, please view the LICENSE 6 | // file that was distributed with this source code. 7 | // 8 | // @author Gorka Laucirica 9 | 10 | // Eric Meyer's Reset CSS v2.0 (http://meyerweb.com/eric/tools/css/reset/) http://cssreset.com 11 | html, 12 | body, 13 | div, 14 | span, 15 | applet, 16 | object, 17 | iframe, 18 | h1 19 | h2, 20 | h3, 21 | h4, 22 | h5, 23 | h6, 24 | p, 25 | blockquote, 26 | pre, 27 | a, 28 | abbr, 29 | acronym, 30 | address, 31 | big, 32 | cite, 33 | code, 34 | del, 35 | dfn, 36 | em, 37 | img, 38 | ins, 39 | kbd, 40 | q, 41 | s, 42 | samp, 43 | small, 44 | strike, 45 | strong, 46 | sub, 47 | sup, 48 | tt, 49 | var, 50 | b, 51 | u, 52 | i, 53 | center, 54 | dl, 55 | dt, 56 | dd, 57 | ol, 58 | ul, 59 | li, 60 | fieldset, 61 | form, 62 | label, 63 | legend, 64 | table, 65 | caption, 66 | tbody, 67 | tfoot, 68 | thead, 69 | tr, 70 | th, 71 | td, 72 | article, 73 | aside, 74 | canvas, 75 | details, 76 | embed, 77 | figure, 78 | figcaption, 79 | footer, 80 | header, 81 | hgroup, 82 | menu, 83 | nav, 84 | output, 85 | ruby, 86 | section, 87 | summary, 88 | time, 89 | mark, 90 | audio, 91 | video { 92 | border: 0; 93 | font: inherit; 94 | font-size: 100%; 95 | margin: 0; 96 | padding: 0; 97 | vertical-align: baseline; 98 | } 99 | 100 | // HTML5 display-role reset for older browsers 101 | article, 102 | aside, 103 | details, 104 | figcaption, 105 | figure, 106 | footer, 107 | header, 108 | hgroup, 109 | menu, 110 | nav, 111 | section { 112 | display: block; 113 | } 114 | 115 | body { 116 | line-height: 1; 117 | } 118 | 119 | ol, 120 | ul { 121 | list-style: none; 122 | } 123 | 124 | blockquote, 125 | q { 126 | quotes: none; 127 | } 128 | 129 | blockquote:before, 130 | blockquote:after, 131 | q:before, 132 | q:after { 133 | content: ''; 134 | content: none; 135 | } 136 | 137 | table { 138 | border-collapse: collapse; 139 | border-spacing: 0; 140 | } 141 | -------------------------------------------------------------------------------- /app/Resources/assets/scss/base/_typography.scss: -------------------------------------------------------------------------------- 1 | // This file is part of the Symfony Standard project. 2 | // 3 | // Copyright (c) 2016 LIN3S 4 | // 5 | // For the full copyright and license information, please view the LICENSE 6 | // file that was distributed with this source code. 7 | // 8 | // @author Gorka Laucirica 9 | -------------------------------------------------------------------------------- /app/Resources/assets/scss/components/_button.scss: -------------------------------------------------------------------------------- 1 | // This file is part of the Symfony Standard project. 2 | // 3 | // Copyright (c) 2016 LIN3S 4 | // 5 | // For the full copyright and license information, please view the LICENSE 6 | // file that was distributed with this source code. 7 | // 8 | // @author Gorka Laucirica 9 | -------------------------------------------------------------------------------- /app/Resources/assets/scss/components/_deprecation-notice.scss: -------------------------------------------------------------------------------- 1 | // This file is part of the Symfony Standard project. 2 | // 3 | // Copyright (c) 2016 LIN3S 4 | // 5 | // For the full copyright and license information, please view the LICENSE 6 | // file that was distributed with this source code. 7 | // 8 | // @author Gorka Laucirica 9 | 10 | .flexbox .deprecation-notice { 11 | display: none; 12 | } 13 | 14 | .deprecation-notice { 15 | background: $white; 16 | bottom: 0; 17 | left: 0; 18 | padding-top: 30px; 19 | position: fixed; 20 | right: 0; 21 | text-align: center; 22 | top: 0; 23 | z-index: 200; 24 | } 25 | 26 | .deprecation-notice__title, 27 | .deprecation-notice__content { 28 | margin: auto; 29 | max-width: 500px; 30 | padding: 0 $global-padding; 31 | } 32 | 33 | .deprecation-notice__title { 34 | font-size: 25px; 35 | font-weight: bold; 36 | margin: 10px auto; 37 | } 38 | -------------------------------------------------------------------------------- /app/Resources/assets/scss/layout/_content.scss: -------------------------------------------------------------------------------- 1 | // This file is part of the Symfony Standard project. 2 | // 3 | // Copyright (c) 2016 LIN3S 4 | // 5 | // For the full copyright and license information, please view the LICENSE 6 | // file that was distributed with this source code. 7 | // 8 | // @author Gorka Laucirica 9 | -------------------------------------------------------------------------------- /app/Resources/assets/scss/layout/_footer.scss: -------------------------------------------------------------------------------- 1 | // This file is part of the Symfony Standard project. 2 | // 3 | // Copyright (c) 2016 LIN3S 4 | // 5 | // For the full copyright and license information, please view the LICENSE 6 | // file that was distributed with this source code. 7 | // 8 | // @author Gorka Laucirica 9 | -------------------------------------------------------------------------------- /app/Resources/assets/scss/layout/_header.scss: -------------------------------------------------------------------------------- 1 | // This file is part of the Symfony Standard project. 2 | // 3 | // Copyright (c) 2016 LIN3S 4 | // 5 | // For the full copyright and license information, please view the LICENSE 6 | // file that was distributed with this source code. 7 | // 8 | // @author Gorka Laucirica 9 | -------------------------------------------------------------------------------- /app/Resources/assets/scss/pages/_404.scss: -------------------------------------------------------------------------------- 1 | // This file is part of the Symfony Standard project. 2 | // 3 | // Copyright (c) 2016 LIN3S 4 | // 5 | // For the full copyright and license information, please view the LICENSE 6 | // file that was distributed with this source code. 7 | // 8 | // @author Gorka Laucirica 9 | -------------------------------------------------------------------------------- /app/Resources/assets/scss/pages/_default.scss: -------------------------------------------------------------------------------- 1 | // This file is part of the Symfony Standard project. 2 | // 3 | // Copyright (c) 2016 LIN3S 4 | // 5 | // For the full copyright and license information, please view the LICENSE 6 | // file that was distributed with this source code. 7 | // 8 | // @author Gorka Laucirica 9 | -------------------------------------------------------------------------------- /app/Resources/assets/scss/pages/_home.scss: -------------------------------------------------------------------------------- 1 | // This file is part of the Symfony Standard project. 2 | // 3 | // Copyright (c) 2016 LIN3S 4 | // 5 | // For the full copyright and license information, please view the LICENSE 6 | // file that was distributed with this source code. 7 | // 8 | // @author Gorka Laucirica 9 | -------------------------------------------------------------------------------- /app/Resources/views/base.html.twig: -------------------------------------------------------------------------------- 1 | 2 | 3 | {% block html_tag %} 4 | 5 | {% endblock html_tag %} 6 | 7 | {% block head %} 8 | 9 | 10 | 11 | {% block title %}Symfony Standard{% endblock title %} 12 | 13 | {% block favicon %} 14 | 15 | 16 | {% endblock %} 17 | 18 | {% block head_style %} 19 | {# Override this block to add your own files! #} 20 | {% if app.debug %} 21 | 22 | {% else %} 23 | 24 | {% endif %} 25 | {% endblock head_style %} 26 | 27 | {% block schema_org %} 28 | {# Schema.org markup for Google+ 29 | - Info: https://developers.google.com/structured-data/ 30 | - Validator: https://developers.google.com/structured-data/testing-tool/ 31 | 32 | 33 | #} 34 | {% endblock schema_org %} 35 | 36 | {% block twitter_card %} 37 | {# Twitter Card data, use only when needed 38 | - Info: https://dev.twitter.com/cards/overview 39 | - Validator: https://dev.twitter.com/docs/cards/validation/validator 40 | 41 | 42 | 43 | 44 | 45 | #} 46 | {% endblock twitter_card %} 47 | 48 | {% block open_graph %} 49 | {# Open Graph data, use only when needed 50 | - Info: https://developers.facebook.com/docs/sharing/best-practices#tags 51 | - Validator: https://developers.facebook.com/tools/debug 52 | 53 | 54 | 55 | 56 | 57 | #} 58 | {% endblock open_graph %} 59 | 60 | {% block head_script %} 61 | 62 | {% endblock head_script %} 63 | 64 | {% block head_bottom %} 65 | {% endblock head_bottom %} 66 | 67 | {% endblock head %} 68 | 69 | {% block body_tag %} 70 | 71 | {% endblock body_tag %} 72 | 73 | {% block google_tag_manager %} 74 |
75 | {% endblock google_tag_manager %} 76 | 77 | {% block body_start %} 78 | {% endblock body_start %} 79 | 80 | {% block body %} 81 | 82 | {% block deprecationNotice %} 83 | {% include 'component/deprecation_notice.html.twig' %} 84 | {% endblock %} 85 | 86 | {% block header %}{% endblock header %} 87 | 88 | {% block content %}{% endblock content %} 89 | 90 | {% block footer_tag_start %} 91 |
92 | {% endblock footer_tag_start %} 93 | 94 | {% block footer %} 95 |

© LIN3S Symfony Standard

96 | {% endblock footer %} 97 | 98 | {% block footer_tag_end %} 99 |
100 | {% endblock footer_tag_end %} 101 | 102 | {% block cookies %} 103 | {% include 'component/cookies.html.twig' %} 104 | {% endblock cookies %} 105 | 106 | {% block body_end_before_js %} 107 | {% endblock body_end_before_js %} 108 | 109 | {% block foot_script %} 110 | {# Overwrite this block to add your own js here #} 111 | {% if app.debug %} 112 | 113 | 114 | 115 | 116 | 117 | 118 | {% else %} 119 | 120 | {% endif %} 121 | {% endblock foot_script %} 122 | {% endblock body %} 123 | 124 | {% block body_end %} 125 | {% endblock body_end %} 126 | 127 | 128 | -------------------------------------------------------------------------------- /app/Resources/views/component/cookies.html.twig: -------------------------------------------------------------------------------- 1 |
2 |
3 |

4 | {{ 'Use of cookies'|trans }} 5 |

6 |

7 | {{ 'This website uses cookies when a user browses through its web pages. Cookies used by the website 8 | are files sent to a web browser via a web server to record the activities of users on the website and 9 | allow more fluid, personalised browsing.'|trans }} 10 | {{ 'Cookies policy'|trans }}. 11 |

12 |
13 | 16 |
17 | -------------------------------------------------------------------------------- /app/Resources/views/component/deprecation_notice.html.twig: -------------------------------------------------------------------------------- 1 |
2 | {# We suggest adding a logo here #} 3 |

{{ 'You are using an outdated browser'|trans }}

4 |

5 | {{ 'In order to deliver the greatest experience to our visitors we use cutting edge web development 6 | techniques that require a modern browser. To view this page please use Google Chrome, Mozilla Firefox or 7 | Internet Explorer 11 or greater'|trans }} 8 |

9 |
10 | -------------------------------------------------------------------------------- /app/Resources/views/default/index.html.twig: -------------------------------------------------------------------------------- 1 | {% extends 'base.html.twig' %} 2 | 3 | {% block head_style %} 4 | {{ parent() }} 5 | 32 | {% endblock head_style %} 33 | 34 | {% block content %} 35 |
36 |
37 |
38 |

Welcome to Symfony {{ constant('Symfony\\Component\\HttpKernel\\Kernel::VERSION') }}

39 |
40 | 41 |
42 |

43 | 44 | 45 | Your application is now ready. You can start working on it at: 46 | {{ base_dir }}/ 47 |

48 |
49 | 50 | 75 | 76 |
77 |
78 | {% endblock %} 79 | -------------------------------------------------------------------------------- /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 | if (version_compare($installedPhpVersion, '7.0.0', '<')) { 429 | $this->addPhpIniRequirement( 430 | 'date.timezone', true, false, 431 | 'date.timezone setting must be set', 432 | 'Set the "date.timezone" setting in php.ini* (like Europe/Paris).' 433 | ); 434 | } 435 | 436 | if (version_compare($installedPhpVersion, self::REQUIRED_PHP_VERSION, '>=')) { 437 | $timezones = array(); 438 | foreach (DateTimeZone::listAbbreviations() as $abbreviations) { 439 | foreach ($abbreviations as $abbreviation) { 440 | $timezones[$abbreviation['timezone_id']] = true; 441 | } 442 | } 443 | 444 | $this->addRequirement( 445 | isset($timezones[@date_default_timezone_get()]), 446 | sprintf('Configured default timezone "%s" must be supported by your installation of PHP', @date_default_timezone_get()), 447 | '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.' 448 | ); 449 | } 450 | 451 | $this->addRequirement( 452 | function_exists('iconv'), 453 | 'iconv() must be available', 454 | 'Install and enable the iconv extension.' 455 | ); 456 | 457 | $this->addRequirement( 458 | function_exists('json_encode'), 459 | 'json_encode() must be available', 460 | 'Install and enable the JSON extension.' 461 | ); 462 | 463 | $this->addRequirement( 464 | function_exists('session_start'), 465 | 'session_start() must be available', 466 | 'Install and enable the session extension.' 467 | ); 468 | 469 | $this->addRequirement( 470 | function_exists('ctype_alpha'), 471 | 'ctype_alpha() must be available', 472 | 'Install and enable the ctype extension.' 473 | ); 474 | 475 | $this->addRequirement( 476 | function_exists('token_get_all'), 477 | 'token_get_all() must be available', 478 | 'Install and enable the Tokenizer extension.' 479 | ); 480 | 481 | $this->addRequirement( 482 | function_exists('simplexml_import_dom'), 483 | 'simplexml_import_dom() must be available', 484 | 'Install and enable the SimpleXML extension.' 485 | ); 486 | 487 | if (function_exists('apc_store') && ini_get('apc.enabled')) { 488 | if (version_compare($installedPhpVersion, '5.4.0', '>=')) { 489 | $this->addRequirement( 490 | version_compare(phpversion('apc'), '3.1.13', '>='), 491 | 'APC version must be at least 3.1.13 when using PHP 5.4', 492 | 'Upgrade your APC extension (3.1.13+).' 493 | ); 494 | } else { 495 | $this->addRequirement( 496 | version_compare(phpversion('apc'), '3.0.17', '>='), 497 | 'APC version must be at least 3.0.17', 498 | 'Upgrade your APC extension (3.0.17+).' 499 | ); 500 | } 501 | } 502 | 503 | $this->addPhpIniRequirement('detect_unicode', false); 504 | 505 | if (extension_loaded('suhosin')) { 506 | $this->addPhpIniRequirement( 507 | 'suhosin.executor.include.whitelist', 508 | create_function('$cfgValue', 'return false !== stripos($cfgValue, "phar");'), 509 | false, 510 | 'suhosin.executor.include.whitelist must be configured correctly in php.ini', 511 | 'Add "phar" to suhosin.executor.include.whitelist in php.ini*.' 512 | ); 513 | } 514 | 515 | if (extension_loaded('xdebug')) { 516 | $this->addPhpIniRequirement( 517 | 'xdebug.show_exception_trace', false, true 518 | ); 519 | 520 | $this->addPhpIniRequirement( 521 | 'xdebug.scream', false, true 522 | ); 523 | 524 | $this->addPhpIniRecommendation( 525 | 'xdebug.max_nesting_level', 526 | create_function('$cfgValue', 'return $cfgValue > 100;'), 527 | true, 528 | 'xdebug.max_nesting_level should be above 100 in php.ini', 529 | '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.' 530 | ); 531 | } 532 | 533 | $pcreVersion = defined('PCRE_VERSION') ? (float) PCRE_VERSION : null; 534 | 535 | $this->addRequirement( 536 | null !== $pcreVersion, 537 | 'PCRE extension must be available', 538 | 'Install the PCRE extension (version 8.0+).' 539 | ); 540 | 541 | if (extension_loaded('mbstring')) { 542 | $this->addPhpIniRequirement( 543 | 'mbstring.func_overload', 544 | create_function('$cfgValue', 'return (int) $cfgValue === 0;'), 545 | true, 546 | 'string functions should not be overloaded', 547 | 'Set "mbstring.func_overload" to 0 in php.ini* to disable function overloading by the mbstring extension.' 548 | ); 549 | } 550 | 551 | /* optional recommendations follow */ 552 | 553 | if (file_exists(__DIR__.'/../vendor/composer')) { 554 | require_once __DIR__.'/../vendor/autoload.php'; 555 | 556 | try { 557 | $r = new ReflectionClass('Sensio\Bundle\DistributionBundle\SensioDistributionBundle'); 558 | 559 | $contents = file_get_contents(dirname($r->getFileName()).'/Resources/skeleton/app/SymfonyRequirements.php'); 560 | } catch (ReflectionException $e) { 561 | $contents = ''; 562 | } 563 | $this->addRecommendation( 564 | file_get_contents(__FILE__) === $contents, 565 | 'Requirements file should be up-to-date', 566 | 'Your requirements file is outdated. Run composer install and re-check your configuration.' 567 | ); 568 | } 569 | 570 | $this->addRecommendation( 571 | version_compare($installedPhpVersion, '5.3.4', '>='), 572 | 'You should use at least PHP 5.3.4 due to PHP bug #52083 in earlier versions', 573 | '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.' 574 | ); 575 | 576 | $this->addRecommendation( 577 | version_compare($installedPhpVersion, '5.3.8', '>='), 578 | 'When using annotations you should have at least PHP 5.3.8 due to PHP bug #55156', 579 | 'Install PHP 5.3.8 or newer if your project uses annotations.' 580 | ); 581 | 582 | $this->addRecommendation( 583 | version_compare($installedPhpVersion, '5.4.0', '!='), 584 | 'You should not use PHP 5.4.0 due to the PHP bug #61453', 585 | '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.' 586 | ); 587 | 588 | $this->addRecommendation( 589 | version_compare($installedPhpVersion, '5.4.11', '>='), 590 | '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)', 591 | 'Install PHP 5.4.11 or newer if your project uses the logout handler from the Symfony Security Component.' 592 | ); 593 | 594 | $this->addRecommendation( 595 | (version_compare($installedPhpVersion, '5.3.18', '>=') && version_compare($installedPhpVersion, '5.4.0', '<')) 596 | || 597 | version_compare($installedPhpVersion, '5.4.8', '>='), 598 | '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', 599 | 'Install PHP 5.3.18+ or PHP 5.4.8+ if you want nice error messages for all fatal errors in the development environment.' 600 | ); 601 | 602 | if (null !== $pcreVersion) { 603 | $this->addRecommendation( 604 | $pcreVersion >= 8.0, 605 | sprintf('PCRE extension should be at least version 8.0 (%s installed)', $pcreVersion), 606 | '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.' 607 | ); 608 | } 609 | 610 | $this->addRecommendation( 611 | class_exists('DomDocument'), 612 | 'PHP-DOM and PHP-XML modules should be installed', 613 | 'Install and enable the PHP-DOM and the PHP-XML modules.' 614 | ); 615 | 616 | $this->addRecommendation( 617 | function_exists('mb_strlen'), 618 | 'mb_strlen() should be available', 619 | 'Install and enable the mbstring extension.' 620 | ); 621 | 622 | $this->addRecommendation( 623 | function_exists('iconv'), 624 | 'iconv() should be available', 625 | 'Install and enable the iconv extension.' 626 | ); 627 | 628 | $this->addRecommendation( 629 | function_exists('utf8_decode'), 630 | 'utf8_decode() should be available', 631 | 'Install and enable the XML extension.' 632 | ); 633 | 634 | $this->addRecommendation( 635 | function_exists('filter_var'), 636 | 'filter_var() should be available', 637 | 'Install and enable the filter extension.' 638 | ); 639 | 640 | if (!defined('PHP_WINDOWS_VERSION_BUILD')) { 641 | $this->addRecommendation( 642 | function_exists('posix_isatty'), 643 | 'posix_isatty() should be available', 644 | 'Install and enable the php_posix extension (used to colorize the CLI output).' 645 | ); 646 | } 647 | 648 | $this->addRecommendation( 649 | extension_loaded('intl'), 650 | 'intl extension should be available', 651 | 'Install and enable the intl extension (used for validators).' 652 | ); 653 | 654 | if (extension_loaded('intl')) { 655 | // in some WAMP server installations, new Collator() returns null 656 | $this->addRecommendation( 657 | null !== new Collator('fr_FR'), 658 | 'intl extension should be correctly configured', 659 | 'The intl extension does not behave properly. This problem is typical on PHP 5.3.X x64 WIN builds.' 660 | ); 661 | 662 | // check for compatible ICU versions (only done when you have the intl extension) 663 | if (defined('INTL_ICU_VERSION')) { 664 | $version = INTL_ICU_VERSION; 665 | } else { 666 | $reflector = new ReflectionExtension('intl'); 667 | 668 | ob_start(); 669 | $reflector->info(); 670 | $output = strip_tags(ob_get_clean()); 671 | 672 | preg_match('/^ICU version +(?:=> )?(.*)$/m', $output, $matches); 673 | $version = $matches[1]; 674 | } 675 | 676 | $this->addRecommendation( 677 | version_compare($version, '4.0', '>='), 678 | 'intl ICU version should be at least 4+', 679 | 'Upgrade your intl extension with a newer ICU version (4+).' 680 | ); 681 | 682 | if (class_exists('Symfony\Component\Intl\Intl')) { 683 | $this->addRecommendation( 684 | \Symfony\Component\Intl\Intl::getIcuDataVersion() <= \Symfony\Component\Intl\Intl::getIcuVersion(), 685 | sprintf('intl ICU version installed on your system is outdated (%s) and does not match the ICU data bundled with Symfony (%s)', \Symfony\Component\Intl\Intl::getIcuVersion(), \Symfony\Component\Intl\Intl::getIcuDataVersion()), 686 | 'To get the latest internationalization data upgrade the ICU system package and the intl PHP extension.' 687 | ); 688 | if (\Symfony\Component\Intl\Intl::getIcuDataVersion() <= \Symfony\Component\Intl\Intl::getIcuVersion()) { 689 | $this->addRecommendation( 690 | \Symfony\Component\Intl\Intl::getIcuDataVersion() === \Symfony\Component\Intl\Intl::getIcuVersion(), 691 | sprintf('intl ICU version installed on your system (%s) does not match the ICU data bundled with Symfony (%s)', \Symfony\Component\Intl\Intl::getIcuVersion(), \Symfony\Component\Intl\Intl::getIcuDataVersion()), 692 | 'To avoid internationalization data incosistencies upgrade the symfony/intl component.' 693 | ); 694 | } 695 | } 696 | 697 | $this->addPhpIniRecommendation( 698 | 'intl.error_level', 699 | create_function('$cfgValue', 'return (int) $cfgValue === 0;'), 700 | true, 701 | 'intl.error_level should be 0 in php.ini', 702 | 'Set "intl.error_level" to "0" in php.ini* to inhibit the messages when an error occurs in ICU functions.' 703 | ); 704 | } 705 | 706 | $accelerator = 707 | (extension_loaded('eaccelerator') && ini_get('eaccelerator.enable')) 708 | || 709 | (extension_loaded('apc') && ini_get('apc.enabled')) 710 | || 711 | (extension_loaded('Zend Optimizer+') && ini_get('zend_optimizerplus.enable')) 712 | || 713 | (extension_loaded('Zend OPcache') && ini_get('opcache.enable')) 714 | || 715 | (extension_loaded('xcache') && ini_get('xcache.cacher')) 716 | || 717 | (extension_loaded('wincache') && ini_get('wincache.ocenabled')) 718 | ; 719 | 720 | $this->addRecommendation( 721 | $accelerator, 722 | 'a PHP accelerator should be installed', 723 | 'Install and/or enable a PHP accelerator (highly recommended).' 724 | ); 725 | 726 | if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') { 727 | $this->addRecommendation( 728 | $this->getRealpathCacheSize() > 1000, 729 | 'realpath_cache_size should be above 1024 in php.ini', 730 | 'Set "realpath_cache_size" to e.g. "1024" in php.ini* to improve performance on windows.' 731 | ); 732 | } 733 | 734 | $this->addPhpIniRecommendation('short_open_tag', false); 735 | 736 | $this->addPhpIniRecommendation('magic_quotes_gpc', false, true); 737 | 738 | $this->addPhpIniRecommendation('register_globals', false, true); 739 | 740 | $this->addPhpIniRecommendation('session.auto_start', false); 741 | 742 | $this->addRecommendation( 743 | class_exists('PDO'), 744 | 'PDO should be installed', 745 | 'Install PDO (mandatory for Doctrine).' 746 | ); 747 | 748 | if (class_exists('PDO')) { 749 | $drivers = PDO::getAvailableDrivers(); 750 | $this->addRecommendation( 751 | count($drivers) > 0, 752 | sprintf('PDO should have some drivers installed (currently available: %s)', count($drivers) ? implode(', ', $drivers) : 'none'), 753 | 'Install PDO drivers (mandatory for Doctrine).' 754 | ); 755 | } 756 | } 757 | 758 | /** 759 | * Loads realpath_cache_size from php.ini and converts it to int. 760 | * 761 | * (e.g. 16k is converted to 16384 int) 762 | * 763 | * @return int 764 | */ 765 | protected function getRealpathCacheSize() 766 | { 767 | $size = ini_get('realpath_cache_size'); 768 | $size = trim($size); 769 | $unit = strtolower(substr($size, -1, 1)); 770 | switch ($unit) { 771 | case 'g': 772 | return $size * 1024 * 1024 * 1024; 773 | case 'm': 774 | return $size * 1024 * 1024; 775 | case 'k': 776 | return $size * 1024; 777 | default: 778 | return (int) $size; 779 | } 780 | } 781 | } 782 | -------------------------------------------------------------------------------- /app/autoload.php: -------------------------------------------------------------------------------- 1 | getPhpIniConfigPath(); 8 | 9 | echo_title('Symfony 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('yellow', ' 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 Symfony projects'); 46 | } else { 47 | echo_block('error', 'ERROR', 'Your system is not ready to run Symfony projects'); 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 | # This file is part of the Symfony Standard project. 2 | # 3 | # Copyright (c) 2016 LIN3S 4 | # 5 | # For the full copyright and license information, please view the LICENSE 6 | # file that was distributed with this source code. 7 | # 8 | # @author Jon Torrado 9 | # @author Beñat Espiña 10 | 11 | imports: 12 | - { resource: parameters.yml } 13 | - { resource: security.yml } 14 | 15 | # Put parameters here that don't need to change on each machine where the app is deployed 16 | # http://symfony.com/doc/current/best_practices/configuration.html#application-related-configuration 17 | parameters: 18 | locale: en 19 | 20 | framework: 21 | #esi: ~ 22 | translator: { fallbacks: ["%locale%"] } 23 | secret: "%secret%" 24 | router: 25 | resource: "%kernel.root_dir%/config/routing.yml" 26 | strict_requirements: ~ 27 | form: ~ 28 | csrf_protection: ~ 29 | validation: { enable_annotations: true } 30 | #serializer: { enable_annotations: true } 31 | templating: 32 | engines: ['twig'] 33 | #assets_version: SomeVersionScheme 34 | default_locale: "%locale%" 35 | trusted_hosts: ~ 36 | trusted_proxies: ~ 37 | session: 38 | handler_id: session.handler.native_file 39 | name: SFSESSID 40 | save_path: "%kernel.root_dir%/sessions/%kernel.environment%" 41 | fragments: ~ 42 | http_method_override: true 43 | #ide: "phpstorm://open?file=%%f&line=%%l" 44 | 45 | # Twig Configuration 46 | twig: 47 | debug: "%kernel.debug%" 48 | strict_variables: "%kernel.debug%" 49 | form_themes: 50 | - 'SonataCoreBundle:Form:datepicker.html.twig' 51 | 52 | # Doctrine Configuration 53 | doctrine: 54 | dbal: 55 | driver: "%database_driver%" 56 | host: "%database_host%" 57 | port: "%database_port%" 58 | dbname: "%database_name%" 59 | user: "%database_user%" 60 | password: "%database_password%" 61 | charset: UTF8 62 | types: 63 | json: Sonata\Doctrine\Types\JsonType 64 | # if using pdo_sqlite as your database driver: 65 | # 1. add the path in parameters.yml 66 | # e.g. database_path: "%kernel.root_dir%/data/data.db3" 67 | # 2. Uncomment database_path in parameters.yml.dist 68 | # 3. Uncomment next line: 69 | # path: "%database_path%" 70 | default_table_options: 71 | charset: utf8mb4 72 | collate: utf8mb4_unicode_ci 73 | engine: InnoDB 74 | #use_savepoints: true 75 | 76 | orm: 77 | auto_generate_proxy_classes: "%kernel.debug%" 78 | naming_strategy: doctrine.orm.naming_strategy.underscore 79 | auto_mapping: true 80 | 81 | # Swiftmailer Configuration 82 | swiftmailer: 83 | transport: "%mailer_transport%" 84 | host: "%mailer_host%" 85 | username: "%mailer_user%" 86 | password: "%mailer_password%" 87 | port: "%mailer_port%" 88 | encryption: "%mailer_encryption%" 89 | spool: { type: memory } 90 | 91 | # Doctrine Migrations Configuration 92 | doctrine_migrations: 93 | dir_name: "%kernel.root_dir%/migrations" 94 | namespace: "%application_name%\\Migrations" 95 | table_name: migration_versions 96 | name: "%application_name% Migrations" 97 | 98 | # LiipImagine Configuration 99 | liip_imagine: 100 | resolvers: 101 | default: 102 | web_path: ~ 103 | 104 | filter_sets: 105 | cache: ~ 106 | #thumb_example: 107 | # quality: 75 108 | # filters: 109 | # thumbnail: { size: [120, 90], mode: outbound } 110 | 111 | # Accelerator Cache Configuration 112 | accelerator_cache: 113 | host: "%router.request_context.scheme%://%router.request_context.host%" 114 | web_dir: "%kernel.root_dir%/../web" 115 | 116 | # StofDoctrineExtensions Configuration 117 | stof_doctrine_extensions: 118 | default_locale: "%locale%" 119 | orm: 120 | default: ~ 121 | #mongodb: 122 | # default: ~ 123 | 124 | # Sonata Admin & User Configuration 125 | sonata_block: 126 | default_contexts: [cms] 127 | blocks: 128 | sonata.user.block.menu: # used to display the menu in profile pages 129 | sonata.user.block.account: # used to display menu option (login option) 130 | sonata.block.service.text: # used to if you plan to use Sonata user routes 131 | sonata.block.service.rss: 132 | sonata.admin.block.admin_list: 133 | contexts: [admin] 134 | 135 | fos_user: 136 | db_driver: orm # other valid values are 'mongodb', 'couchdb' and 'propel' 137 | firewall_name: main 138 | user_class: Application\Sonata\UserBundle\Entity\User 139 | group: 140 | group_class: Application\Sonata\UserBundle\Entity\Group 141 | group_manager: sonata.user.orm.group_manager 142 | service: 143 | user_manager: sonata.user.orm.user_manager 144 | 145 | sonata_user: 146 | manager_type: orm # can be orm or mongodb 147 | admin: 148 | user: 149 | class: Application\Sonata\UserBundle\Admin\UserAdmin 150 | 151 | -------------------------------------------------------------------------------- /app/config/config_dev.yml: -------------------------------------------------------------------------------- 1 | # This file is part of the Symfony Standard project. 2 | # 3 | # Copyright (c) 2016 LIN3S 4 | # 5 | # For the full copyright and license information, please view the LICENSE 6 | # file that was distributed with this source code. 7 | # 8 | # @author Jon Torrado 9 | # @author Beñat Espiña 10 | 11 | imports: 12 | - { resource: config.yml } 13 | 14 | framework: 15 | router: 16 | resource: "%kernel.root_dir%/config/routing_dev.yml" 17 | strict_requirements: true 18 | profiler: { only_exceptions: false } 19 | 20 | web_profiler: 21 | toolbar: true 22 | intercept_redirects: false 23 | 24 | monolog: 25 | handlers: 26 | main: 27 | type: stream 28 | path: "%kernel.logs_dir%/%kernel.environment%.log" 29 | level: debug 30 | channels: [!event] 31 | console: 32 | type: console 33 | bubble: false 34 | verbosity_levels: 35 | VERBOSITY_VERBOSE: INFO 36 | VERBOSITY_VERY_VERBOSE: DEBUG 37 | channels: [!event, !doctrine] 38 | console_very_verbose: 39 | type: console 40 | bubble: false 41 | verbosity_levels: 42 | VERBOSITY_VERBOSE: NOTICE 43 | VERBOSITY_VERY_VERBOSE: NOTICE 44 | VERBOSITY_DEBUG: DEBUG 45 | channels: ["doctrine"] 46 | # uncomment to get logging in your browser 47 | # you may have to allow bigger header sizes in your Web server configuration 48 | #firephp: 49 | # type: firephp 50 | # level: info 51 | #chromephp: 52 | # type: chromephp 53 | # level: info 54 | 55 | #swiftmailer: 56 | # delivery_address: me@example.com 57 | -------------------------------------------------------------------------------- /app/config/config_prod.yml: -------------------------------------------------------------------------------- 1 | # This file is part of the Symfony Standard project. 2 | # 3 | # Copyright (c) 2016 LIN3S 4 | # 5 | # For the full copyright and license information, please view the LICENSE 6 | # file that was distributed with this source code. 7 | # 8 | # @author Jon Torrado 9 | # @author Beñat Espiña 10 | 11 | imports: 12 | - { resource: config.yml } 13 | 14 | #framework: 15 | # validation: 16 | # cache: validator.mapping.cache.apc 17 | # serializer: 18 | # cache: serializer.mapping.cache.apc 19 | 20 | #doctrine: 21 | # orm: 22 | # metadata_cache_driver: apc 23 | # result_cache_driver: apc 24 | # query_cache_driver: apc 25 | 26 | monolog: 27 | handlers: 28 | main: 29 | type: fingers_crossed 30 | action_level: error 31 | handler: nested 32 | nested: 33 | type: stream 34 | path: "%kernel.logs_dir%/%kernel.environment%.log" 35 | level: debug 36 | channels: "!event" 37 | console: 38 | type: console 39 | #login: 40 | # type: stream 41 | # path: "%kernel.logs_dir%/auth.log" 42 | # level: info 43 | # channels: security 44 | #mail: 45 | # type: fingers_crossed 46 | # action_level: critical 47 | # handler: buffered 48 | #buffered: 49 | # type: buffer 50 | # handler: swift 51 | #swift: 52 | # type: swift_mailer 53 | # from_email: noreply@website.com 54 | # to_email: webmaster@company.com 55 | # subject: "Fatal error" 56 | # level: debug 57 | -------------------------------------------------------------------------------- /app/config/config_test.yml: -------------------------------------------------------------------------------- 1 | # This file is part of the Symfony Standard project. 2 | # 3 | # Copyright (c) 2016 LIN3S 4 | # 5 | # For the full copyright and license information, please view the LICENSE 6 | # file that was distributed with this source code. 7 | # 8 | # @author Jon Torrado 9 | # @author Beñat Espiña 10 | 11 | imports: 12 | - { resource: config_dev.yml } 13 | 14 | framework: 15 | test: ~ 16 | session: 17 | storage_id: session.storage.mock_file 18 | profiler: 19 | collect: false 20 | 21 | web_profiler: 22 | toolbar: false 23 | intercept_redirects: false 24 | 25 | swiftmailer: 26 | disable_delivery: true 27 | -------------------------------------------------------------------------------- /app/config/parameters.yml.dist: -------------------------------------------------------------------------------- 1 | # This file is part of the Symfony Standard project. 2 | # 3 | # Copyright (c) 2016 LIN3S 4 | # 5 | # For the full copyright and license information, please view the LICENSE 6 | # file that was distributed with this source code. 7 | # 8 | # @author Jon Torrado 9 | # @author Beñat Espiña 10 | 11 | parameters: 12 | database_driver: pdo_mysql 13 | database_host: 127.0.0.1 14 | database_port: ~ 15 | database_name: symfony 16 | database_user: root 17 | database_password: ~ 18 | # You should uncomment this if you want use pdo_sqlite 19 | # database_path: "%kernel.root_dir%/data.db3" 20 | 21 | mailer_transport: smtp 22 | mailer_host: 127.0.0.1 23 | mailer_user: ~ 24 | mailer_password: ~ 25 | mailer_port: ~ 26 | mailer_encryption: ~ 27 | 28 | # A secret key that's used to generate certain security-related tokens 29 | secret: 946672a831b47e20ec70435c92ebd586be6cb4af 30 | 31 | application_name: Application # Application name used in config files 32 | 33 | # Generate URLs and Send Emails from the Console http://symfony.com/doc/current/cookbook/console/sending_emails.html 34 | router.request_context.host: example.org 35 | router.request_context.scheme: https 36 | router.request_context.base_url: my/path 37 | -------------------------------------------------------------------------------- /app/config/routing.yml: -------------------------------------------------------------------------------- 1 | # This file is part of the Symfony Standard project. 2 | # 3 | # Copyright (c) 2016 LIN3S 4 | # 5 | # For the full copyright and license information, please view the LICENSE 6 | # file that was distributed with this source code. 7 | # 8 | # @author Jon Torrado 9 | # @author Beñat Espiña 10 | 11 | admin: 12 | resource: "@SonataAdminBundle/Resources/config/routing/sonata_admin.xml" 13 | prefix: /admin 14 | 15 | _sonata_admin: 16 | resource: . 17 | type: sonata_admin 18 | prefix: /admin 19 | 20 | sonata_user_security: 21 | resource: "@SonataUserBundle/Resources/config/routing/sonata_security_1.xml" 22 | 23 | sonata_user_resetting: 24 | resource: "@SonataUserBundle/Resources/config/routing/sonata_resetting_1.xml" 25 | prefix: /resetting 26 | 27 | sonata_user_profile: 28 | resource: "@SonataUserBundle/Resources/config/routing/sonata_profile_1.xml" 29 | prefix: /profile 30 | 31 | sonata_user_register: 32 | resource: "@SonataUserBundle/Resources/config/routing/sonata_registration_1.xml" 33 | prefix: /register 34 | 35 | sonata_user_change_password: 36 | resource: "@SonataUserBundle/Resources/config/routing/sonata_change_password_1.xml" 37 | prefix: /profile 38 | 39 | sonata_user: 40 | resource: '@SonataUserBundle/Resources/config/routing/admin_security.xml' 41 | prefix: /admin 42 | 43 | _liip_imagine: 44 | resource: "@LiipImagineBundle/Resources/config/routing.xml" 45 | 46 | app: 47 | resource: "@AppBundle/Controller/" 48 | type: annotation 49 | -------------------------------------------------------------------------------- /app/config/routing_dev.yml: -------------------------------------------------------------------------------- 1 | # This file is part of the Symfony Standard project. 2 | # 3 | # Copyright (c) 2016 LIN3S 4 | # 5 | # For the full copyright and license information, please view the LICENSE 6 | # file that was distributed with this source code. 7 | # 8 | # @author Jon Torrado 9 | # @author Beñat Espiña 10 | 11 | _wdt: 12 | resource: "@WebProfilerBundle/Resources/config/routing/wdt.xml" 13 | prefix: /_wdt 14 | 15 | _profiler: 16 | resource: "@WebProfilerBundle/Resources/config/routing/profiler.xml" 17 | prefix: /_profiler 18 | 19 | _errors: 20 | resource: "@TwigBundle/Resources/config/routing/errors.xml" 21 | prefix: /_error 22 | 23 | _main: 24 | resource: routing.yml 25 | -------------------------------------------------------------------------------- /app/config/security.yml: -------------------------------------------------------------------------------- 1 | # This file is part of the Symfony Standard project. 2 | # 3 | # Copyright (c) 2016 LIN3S 4 | # 5 | # For the full copyright and license information, please view the LICENSE 6 | # file that was distributed with this source code. 7 | # 8 | # @author Jon Torrado 9 | # @author Beñat Espiña 10 | 11 | security: 12 | encoders: 13 | FOS\UserBundle\Model\UserInterface: bcrypt 14 | 15 | role_hierarchy: 16 | ROLE_ADMIN: [ROLE_USER, ROLE_SONATA_ADMIN] 17 | ROLE_SUPER_ADMIN: [ROLE_ADMIN, ROLE_ALLOWED_TO_SWITCH] 18 | SONATA: 19 | - ROLE_SONATA_PAGE_ADMIN_PAGE_EDIT 20 | 21 | providers: 22 | fos_userbundle: 23 | id: fos_user.user_manager 24 | 25 | firewalls: 26 | # disables authentication for assets and the profiler, adapt it according to your needs 27 | dev: 28 | pattern: ^/(_(profiler|wdt)|css|images|js)/ 29 | security: false 30 | 31 | # -> custom firewall for the admin area of the URL 32 | admin: 33 | pattern: /admin(.*) 34 | context: user 35 | form_login: 36 | provider: fos_userbundle 37 | login_path: sonata_user_admin_security_login 38 | use_forward: false 39 | check_path: sonata_user_admin_security_check 40 | failure_path: null 41 | logout: 42 | path: sonata_user_admin_security_logout 43 | anonymous: true 44 | # -> end custom configuration 45 | 46 | # default login area for standard users 47 | 48 | # This firewall is used to handle the public login area 49 | # This part is handled by the FOS User Bundle 50 | main: 51 | pattern: .* 52 | context: user 53 | form_login: 54 | provider: fos_userbundle 55 | login_path: fos_user_security_login 56 | use_forward: false 57 | check_path: fos_user_security_check 58 | failure_path: null 59 | remember_me: 60 | secret: "%secret%" 61 | lifetime: 31536000 62 | path: / 63 | domain: ~ 64 | logout: 65 | path: fos_user_security_logout 66 | anonymous: true 67 | 68 | access_control: 69 | # URL of FOSUserBundle which need to be available to anonymous users 70 | - { path: ^/login$, role: IS_AUTHENTICATED_ANONYMOUSLY } 71 | - { path: ^/register, role: IS_AUTHENTICATED_ANONYMOUSLY } 72 | - { path: ^/resetting, role: IS_AUTHENTICATED_ANONYMOUSLY } 73 | 74 | # Admin login page needs to be access without credential 75 | - { path: ^/admin/login$, role: IS_AUTHENTICATED_ANONYMOUSLY } 76 | - { path: ^/admin/logout$, role: IS_AUTHENTICATED_ANONYMOUSLY } 77 | - { path: ^/admin/login_check$, role: IS_AUTHENTICATED_ANONYMOUSLY } 78 | 79 | # Secured part of the site 80 | # This config requires being logged for the whole site and having the admin role for the admin part. 81 | # Change these rules to adapt them to your needs 82 | - { path: ^/admin/, role: [ROLE_ADMIN, ROLE_SONATA_ADMIN] } 83 | - { path: ^/.*, role: IS_AUTHENTICATED_ANONYMOUSLY } 84 | -------------------------------------------------------------------------------- /app/console: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env php 2 | getParameterOption(array('--env', '-e'), getenv('SYMFONY_ENV') ?: 'dev'); 21 | $debug = getenv('SYMFONY_DEBUG') !== '0' && !$input->hasParameterOption(array('--no-debug', '')) && $env !== 'prod'; 22 | 23 | if ($debug) { 24 | Debug::enable(); 25 | } 26 | 27 | $kernel = new AppKernel($env, $debug); 28 | $application = new Application($kernel); 29 | $application->run($input); 30 | -------------------------------------------------------------------------------- /app/logs/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LIN3S/SymfonyStandard/425eda1e19b20404708d6531b6966cd3ef740bfa/app/logs/.gitkeep -------------------------------------------------------------------------------- /app/migrations/Version20150914111050.php: -------------------------------------------------------------------------------- 1 | abortIf($this->connection->getDatabasePlatform()->getName() != 'mysql', 'Migration can only be executed safely on \'mysql\'.'); 20 | 21 | $this->addSql('CREATE TABLE fos_user_user (id INT AUTO_INCREMENT NOT NULL, username VARCHAR(255) NOT NULL, username_canonical VARCHAR(255) NOT NULL, email VARCHAR(255) NOT NULL, email_canonical VARCHAR(255) NOT NULL, enabled TINYINT(1) NOT NULL, salt VARCHAR(255) NOT NULL, password VARCHAR(255) NOT NULL, last_login DATETIME DEFAULT NULL, locked TINYINT(1) NOT NULL, expired TINYINT(1) NOT NULL, expires_at DATETIME DEFAULT NULL, confirmation_token VARCHAR(255) DEFAULT NULL, password_requested_at DATETIME DEFAULT NULL, roles LONGTEXT NOT NULL COMMENT \'(DC2Type:array)\', credentials_expired TINYINT(1) NOT NULL, credentials_expire_at DATETIME DEFAULT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, date_of_birth DATETIME DEFAULT NULL, firstname VARCHAR(64) DEFAULT NULL, lastname VARCHAR(64) DEFAULT NULL, website VARCHAR(64) DEFAULT NULL, biography VARCHAR(1000) DEFAULT NULL, gender VARCHAR(1) DEFAULT NULL, locale VARCHAR(8) DEFAULT NULL, timezone VARCHAR(64) DEFAULT NULL, phone VARCHAR(64) DEFAULT NULL, facebook_uid VARCHAR(255) DEFAULT NULL, facebook_name VARCHAR(255) DEFAULT NULL, facebook_data LONGTEXT DEFAULT NULL COMMENT \'(DC2Type:json)\', twitter_uid VARCHAR(255) DEFAULT NULL, twitter_name VARCHAR(255) DEFAULT NULL, twitter_data LONGTEXT DEFAULT NULL COMMENT \'(DC2Type:json)\', gplus_uid VARCHAR(255) DEFAULT NULL, gplus_name VARCHAR(255) DEFAULT NULL, gplus_data LONGTEXT DEFAULT NULL COMMENT \'(DC2Type:json)\', token VARCHAR(255) DEFAULT NULL, two_step_code VARCHAR(255) DEFAULT NULL, UNIQUE INDEX UNIQ_C560D76192FC23A8 (username_canonical), UNIQUE INDEX UNIQ_C560D761A0D96FBF (email_canonical), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB'); 22 | $this->addSql('CREATE TABLE fos_user_user_group (user_id INT NOT NULL, group_id INT NOT NULL, INDEX IDX_B3C77447A76ED395 (user_id), INDEX IDX_B3C77447FE54D947 (group_id), PRIMARY KEY(user_id, group_id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB'); 23 | $this->addSql('CREATE TABLE fos_user_group (id INT AUTO_INCREMENT NOT NULL, name VARCHAR(255) NOT NULL, roles LONGTEXT NOT NULL COMMENT \'(DC2Type:array)\', UNIQUE INDEX UNIQ_583D1F3E5E237E06 (name), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB'); 24 | $this->addSql('ALTER TABLE fos_user_user_group ADD CONSTRAINT FK_B3C77447A76ED395 FOREIGN KEY (user_id) REFERENCES fos_user_user (id) ON DELETE CASCADE'); 25 | $this->addSql('ALTER TABLE fos_user_user_group ADD CONSTRAINT FK_B3C77447FE54D947 FOREIGN KEY (group_id) REFERENCES fos_user_group (id) ON DELETE CASCADE'); 26 | 27 | } 28 | 29 | /** 30 | * @param Schema $schema 31 | */ 32 | public function down(Schema $schema) 33 | { 34 | // this down() migration is auto-generated, please modify it to your needs 35 | $this->abortIf($this->connection->getDatabasePlatform()->getName() != 'mysql', 'Migration can only be executed safely on \'mysql\'.'); 36 | 37 | $this->addSql('ALTER TABLE fos_user_user_group DROP FOREIGN KEY FK_B3C77447A76ED395'); 38 | $this->addSql('ALTER TABLE fos_user_user_group DROP FOREIGN KEY FK_B3C77447FE54D947'); 39 | $this->addSql('DROP TABLE fos_user_user'); 40 | $this->addSql('DROP TABLE fos_user_user_group'); 41 | $this->addSql('DROP TABLE fos_user_group'); 42 | 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /app/sessions/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LIN3S/SymfonyStandard/425eda1e19b20404708d6531b6966cd3ef740bfa/app/sessions/.gitkeep -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "lin3s/symfony-standard", 3 | "description": "The \"Symfony Standard Edition\" distribution in the LIN3S way", 4 | "keywords": ["lin3s", "symfony", "standard"], 5 | "type": "project", 6 | "license": "MIT", 7 | "authors": [ 8 | { 9 | "name": "LIN3S", 10 | "email": "info@lin3s.com", 11 | "homepage": "https://lin3s.com" 12 | } 13 | ], 14 | "require": { 15 | "php": ">=5.4", 16 | 17 | "doctrine/dbal": "2.5.*", 18 | "doctrine/doctrine-bundle": "^1.6", 19 | "doctrine/orm": "^2.4.8", 20 | "sensio/distribution-bundle": "^5.0", 21 | "sensio/framework-extra-bundle": "^3.0.2", 22 | "incenteev/composer-parameter-handler": "^2.0", 23 | "symfony/monolog-bundle": "^2.4", 24 | "symfony/swiftmailer-bundle": "^2.3", 25 | "symfony/symfony": "2.8.*", 26 | 27 | "doctrine/migrations": "^1.4", 28 | "doctrine/doctrine-migrations-bundle": "^1.1", 29 | "liip/imagine-bundle": "^1.5", 30 | "smart-core/accelerator-cache-bundle": "^1.2.0", 31 | "stof/doctrine-extensions-bundle": "^1.2", 32 | 33 | "sonata-project/admin-bundle": "^3.4.0", 34 | "sonata-project/doctrine-orm-admin-bundle": "^3.0.5", 35 | "sonata-project/user-bundle": "^3.0.1", 36 | 37 | "lin3s/cs": "~0.3", 38 | "lin3s/lin3s-distribution": "^1.2" 39 | }, 40 | "require-dev": { 41 | "behat/behat" : "^3.1", 42 | "behat/mink-browserkit-driver": "^1.3", 43 | "behat/mink-extension" : "^2.2", 44 | "behat/symfony2-extension" : "^2.1", 45 | "behat/web-api-extension": "~1.0@dev", 46 | "doctrine/doctrine-fixtures-bundle": "^2.3.0", 47 | "henrikbjorn/phpspec-code-coverage": "^1.0", 48 | "phpspec/phpspec": "^2.5", 49 | "sensio/generator-bundle": "^3.0" 50 | }, 51 | "scripts": { 52 | "post-root-package-install": [ 53 | "SymfonyStandard\\Composer::hookRootPackageInstall" 54 | ], 55 | "post-install-cmd": [ 56 | "LIN3S\\CS\\Composer\\Hooks::buildDistFile", 57 | "Incenteev\\ParameterHandler\\ScriptHandler::buildParameters", 58 | "LIN3S\\CS\\Composer\\Hooks::addHooks", 59 | "LIN3S\\CS\\Composer\\Hooks::addFiles", 60 | "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap", 61 | "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache", 62 | "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets", 63 | "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile", 64 | "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::removeSymfonyStandardFiles", 65 | "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::prepareDeploymentTarget" 66 | ], 67 | "post-update-cmd": [ 68 | "LIN3S\\CS\\Composer\\Hooks::buildDistFile", 69 | "Incenteev\\ParameterHandler\\ScriptHandler::buildParameters", 70 | "LIN3S\\CS\\Composer\\Hooks::addHooks", 71 | "LIN3S\\CS\\Composer\\Hooks::addFiles", 72 | "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap", 73 | "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache", 74 | "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets", 75 | "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile", 76 | "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::removeSymfonyStandardFiles", 77 | "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::prepareDeploymentTarget" 78 | ] 79 | }, 80 | "autoload": { 81 | "psr-4": { 82 | "AppBundle\\": "src/AppBundle/", 83 | "Application\\Sonata\\UserBundle\\": "src/Application/Sonata/UserBundle/" 84 | }, 85 | "classmap": [ "app/AppKernel.php", "app/AppCache.php" ], 86 | "exclude-from-classmap": [ "/Tests/", "/test/", "/tests/" ] 87 | }, 88 | "config": { 89 | "bin-dir": "bin" 90 | }, 91 | "extra": { 92 | "symfony-app-dir": "app", 93 | "symfony-web-dir": "web", 94 | "symfony-assets-install": "relative", 95 | "incenteev-parameters": [ 96 | { 97 | "file": "app/config/parameters.yml" 98 | }, 99 | { 100 | "file": ".lin3s_cs.yml", 101 | "dist-file": ".lin3s_cs.yml.dist" 102 | } 103 | ] 104 | } 105 | } 106 | -------------------------------------------------------------------------------- /deploy/deploy.rb: -------------------------------------------------------------------------------- 1 | # This file is part of the Symfony Standard project. 2 | # 3 | # Copyright (c) 2016 LIN3S 4 | # 5 | # For the full copyright and license information, please view the LICENSE 6 | # file that was distributed with this source code. 7 | # 8 | # @author Gorka Laucirica 9 | # @author Beñat Espiña 10 | # @author Jon Torrado 11 | 12 | ############################################ 13 | # Setup project 14 | ############################################ 15 | 16 | set :application, "symfony-standard" 17 | set :repo_url, "https://github.com/LIN3S/SymfonyStandard.git" 18 | set :scm, :git 19 | set :sessions_path, fetch(:app_path) + "/sessions" 20 | 21 | ############################################ 22 | # Setup Capistrano 23 | ############################################ 24 | 25 | set :log_level, :info 26 | set :use_sudo, false 27 | 28 | set :ssh_options, { 29 | forward_agent: true 30 | } 31 | 32 | set :keep_releases, 3 33 | 34 | ############################################ 35 | # Linked files and directories (symlinks) 36 | ############################################ 37 | 38 | set :linked_files, ["app/config/parameters.yml"] 39 | set :linked_dirs, [fetch(:log_path), fetch(:sessions_path), fetch(:web_path) + "/uploads"] 40 | set :file_permissions_paths, [fetch(:cache_path), fetch(:log_path), fetch(:sessions_path)] 41 | 42 | set :composer_install_flags, '--no-interaction --optimize-autoloader' 43 | 44 | namespace :deploy do 45 | before :starting, 'git:check_branch' 46 | after :starting, 'composer:install_executable' 47 | after :updated, 'compile_and_upload:gulp' 48 | after :updated, 'compile_and_upload:upload' 49 | after :updated, 'database:migrate' 50 | #after :finishing, 'cache:clear' 51 | end 52 | -------------------------------------------------------------------------------- /deploy/stages/dev1.rb: -------------------------------------------------------------------------------- 1 | # This file is part of the Symfony Standard project. 2 | # 3 | # Copyright (c) 2016 LIN3S 4 | # 5 | # For the full copyright and license information, please view the LICENSE 6 | # file that was distributed with this source code. 7 | # 8 | # @author Gorka Laucirica 9 | # @author Beñat Espiña 10 | # @author Jon Torrado 11 | 12 | ###################################################################### 13 | # Setup Server 14 | ###################################################################### 15 | server "dev.company.com", user: "sshuser", roles: %w{web} 16 | set :deploy_to, "/path/to/your/deployment/directory" 17 | set :env, "dev" 18 | set :cache_opts, "-u user:password" 19 | set :domain, "http://devwebsite.domain.com" 20 | 21 | ###################################################################### 22 | # Capistrano Symfony - https://github.com/capistrano/symfony/#settings 23 | ###################################################################### 24 | set :file_permissions_users, ['www-data'] 25 | set :webserver_user, "www-data" 26 | 27 | ###################################################################### 28 | # Setup Git 29 | ###################################################################### 30 | set :branch, "master" 31 | -------------------------------------------------------------------------------- /deploy/tasks/cache_clear.cap: -------------------------------------------------------------------------------- 1 | # This file is part of the Symfony Standard project. 2 | # 3 | # Copyright (c) 2016 LIN3S 4 | # 5 | # For the full copyright and license information, please view the LICENSE 6 | # file that was distributed with this source code. 7 | # 8 | # @author Gorka Laucirica 9 | # @author Beñat Espiña 10 | # @author Jon Torrado 11 | 12 | namespace :cache do 13 | desc 'Clear accelerator caches' 14 | task :clear do 15 | invoke 'symfony:console', 'cache:accelerator:clear', "#{fetch(:cache_opts)}" 16 | end 17 | end 18 | -------------------------------------------------------------------------------- /deploy/tasks/compile_upload.cap: -------------------------------------------------------------------------------- 1 | # This file is part of the Symfony Standard project. 2 | # 3 | # Copyright (c) 2016 LIN3S 4 | # 5 | # For the full copyright and license information, please view the LICENSE 6 | # file that was distributed with this source code. 7 | # 8 | # @author Gorka Laucirica 9 | # @author Beñat Espiña 10 | # @author Jon Torrado 11 | 12 | namespace :compile_and_upload do 13 | desc 'Execute Gulp tasks' 14 | task :gulp do 15 | if fetch(:env) == "prod" 16 | run_locally do 17 | execute "gulp prod" 18 | end 19 | else 20 | on roles(:all) do |host| 21 | execute "cd #{release_path}; npm install && gulp prod" 22 | end 23 | end 24 | end 25 | 26 | desc 'Upload needed files' 27 | task :upload do 28 | if fetch(:env) == "prod" 29 | on roles(:all) do |host| 30 | upload! "#{fetch(:web_path)}/css", "#{release_path}/#{fetch(:web_path)}", recursive: true 31 | upload! "#{fetch(:web_path)}/js", "#{release_path}/#{fetch(:web_path)}", recursive: true 32 | end 33 | end 34 | end 35 | end 36 | -------------------------------------------------------------------------------- /deploy/tasks/database_download.cap: -------------------------------------------------------------------------------- 1 | # This file is part of the Symfony Standard project. 2 | # 3 | # Copyright (c) 2016 LIN3S 4 | # 5 | # For the full copyright and license information, please view the LICENSE 6 | # file that was distributed with this source code. 7 | # 8 | # @author Jon Torrado 9 | 10 | namespace :database do 11 | desc 'Remote database download' 12 | task :download do 13 | on roles(:all) do |host| 14 | dbuser, dbpass, dbname = nil, nil, nil 15 | file = capture "cat #{shared_path}/app/config/parameters.yml" 16 | file.each_line do |line| 17 | line.split("\t").each do |item| 18 | if item.include? "database_user" 19 | dbuser = item.gsub(/(\'|\"|\:|\ |\n|database_user)/, '') 20 | end 21 | if item.include? "database_password" 22 | dbpass = item.gsub(/(\'|\"|\:|\ |\n|database_password)/, '') 23 | end 24 | if item.include? "database_name" 25 | dbname = item.gsub(/(\'|\"|\:|\ |\n|database_name)/, '') 26 | end 27 | end 28 | end 29 | if dbuser != nil and dbpass != nil and dbname != nil 30 | execute "cd #{shared_path};mysqldump -u'#{dbuser}' -p'#{dbpass}' #{dbname} > #{dbname}_cap.sql" 31 | download! "#{shared_path}/#{dbname}_cap.sql", "." 32 | execute :rm, "-f", "#{shared_path}/#{dbname}_cap.sql" 33 | else 34 | puts "Cannot download file (dbuser or dbpass or dbname not found)" 35 | end 36 | end 37 | end 38 | end 39 | -------------------------------------------------------------------------------- /deploy/tasks/database_migrations.cap: -------------------------------------------------------------------------------- 1 | # This file is part of the Symfony Standard project. 2 | # 3 | # Copyright (c) 2016 LIN3S 4 | # 5 | # For the full copyright and license information, please view the LICENSE 6 | # file that was distributed with this source code. 7 | # 8 | # @author Gorka Laucirica 9 | # @author Beñat Espiña 10 | # @author Jon Torrado 11 | 12 | namespace :database do 13 | desc 'Execute database migrations' 14 | task :migrate do 15 | invoke 'symfony:console', 'doctrine:migrations:migrate', '--no-interaction' 16 | end 17 | end 18 | -------------------------------------------------------------------------------- /deploy/tasks/git_check_branch.cap: -------------------------------------------------------------------------------- 1 | # This file is part of the Symfony Standard project. 2 | # 3 | # Copyright (c) 2016 LIN3S 4 | # 5 | # For the full copyright and license information, please view the LICENSE 6 | # file that was distributed with this source code. 7 | # 8 | # @author Gorka Laucirica 9 | # @author Beñat Espiña 10 | # @author Jon Torrado 11 | 12 | namespace :git do 13 | desc 'Checks for same actual and deploy branch' 14 | task :check_branch do 15 | current_branch = `git branch`.match(/\* (\S+)\s/m)[1] 16 | if current_branch != fetch(:branch) 17 | puts "\e[31mCurrent branch '#{current_branch}' differs from deployment branch, stopping\e[0m" 18 | exit 1 19 | end 20 | end 21 | end 22 | -------------------------------------------------------------------------------- /deploy/tasks/server_ensure.cap: -------------------------------------------------------------------------------- 1 | # This file is part of the Symfony Standard project. 2 | # 3 | # Copyright (c) 2015-2016 LIN3S 4 | # 5 | # For the full copyright and license information, please view the LICENSE 6 | # file that was distributed with this source code. 7 | # 8 | # @author Gorka Laucirica 9 | # @author Beñat Espiña 10 | # @author Jon Torrado 11 | 12 | namespace :server do 13 | reset = "\033[0m" 14 | success = "\e[1m\e[32m" 15 | failure = "\e[1m\e[31m" 16 | desc 'Ensure linked server files' 17 | task :ensure do 18 | on roles(:all) do |host| 19 | fetch(:linked_files, []).each do |file| 20 | if test("[ -f #{shared_path}/#{file} ]") 21 | puts "Checking #{shared_path}/#{file}... #{success}OK#{reset}" 22 | else 23 | puts "Checking #{shared_path}/#{file}... #{failure}failed! Uploading...#{reset}" 24 | filePaths, tmpFilePath = file.split('/'), '' 25 | for index in 0 ... (filePaths.size - 1) 26 | tmpFilePath += "/#{filePaths[index]}" 27 | end 28 | unless test("[ -d #{shared_path}#{tmpFilePath} ]") 29 | execute "mkdir -p #{shared_path}#{tmpFilePath}" 30 | end 31 | upload! file, "#{shared_path}/#{file}" 32 | if test("[ -f #{shared_path}/#{file} ]") 33 | puts "Uploading #{shared_path}/#{file}... #{success}uploaded!#{reset}" 34 | else 35 | puts "Uploading #{shared_path}/#{file}... #{failure}failed! Check manually!#{reset}" 36 | end 37 | end 38 | end 39 | end 40 | end 41 | end 42 | -------------------------------------------------------------------------------- /gulpfile.js: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the Symfony Standard project. 3 | * 4 | * Copyright (c) 2016 LIN3S 5 | * 6 | * For the full copyright and license information, please view the LICENSE 7 | * file that was distributed with this source code. 8 | * 9 | * @author Jon Torrado 10 | * @author Beñat Espiña 11 | */ 12 | 13 | 'use strict'; 14 | 15 | var gulp = require('gulp'), 16 | concat = require('gulp-concat'), 17 | cssnext = require('postcss-cssnext'), 18 | cssnano = require('gulp-cssnano'), 19 | livereload = require('gulp-livereload'), 20 | modernizr = require('gulp-modernizr'), 21 | plumber = require('gulp-plumber'), 22 | postcss = require('gulp-postcss'), 23 | rename = require('gulp-rename'), 24 | sass = require('gulp-sass'), 25 | scsslint = require('gulp-scss-lint'), 26 | svgSprite = require('gulp-svg-sprite'), 27 | uglify = require('gulp-uglify'); 28 | 29 | var paths = { 30 | npm: './node_modules', 31 | sass: './app/Resources/assets/scss', 32 | js: './app/Resources/assets/js', 33 | svg: './app/Resources/assets/svg', 34 | buildCss: './web/css', 35 | buildJs: './web/js', 36 | buildSvg: './web/svg' 37 | }; 38 | 39 | // Plumber error function 40 | function onError(err) { 41 | console.log(err); 42 | this.emit('end'); 43 | } 44 | 45 | gulp.task('sass', ['scss-lint'], function () { 46 | gulp.src(paths.sass + '/app.scss') 47 | .pipe(plumber({ 48 | errorHandler: onError 49 | })) 50 | .pipe(sass({ 51 | errLogToConsole: true 52 | })) 53 | .pipe(postcss([cssnext])) 54 | .pipe(gulp.dest(paths.buildCss)) 55 | .pipe(livereload()); 56 | }); 57 | 58 | gulp.task('sass:prod', function () { 59 | gulp.src(paths.sass + '/app.scss') 60 | .pipe(plumber({ 61 | errorHandler: onError 62 | })) 63 | .pipe(sass()) 64 | .pipe(postcss([cssnext])) 65 | .pipe(cssnano({ 66 | keepSpecialComments: 1, 67 | rebase: false 68 | })) 69 | .pipe(rename({suffix: '.min'})) 70 | .pipe(gulp.dest(paths.buildCss)); 71 | }); 72 | 73 | gulp.task('scss-lint', function () { 74 | gulp.src([ 75 | paths.sass + '/**/*.scss', 76 | '!' + paths.sass + '/base/_reset.scss' 77 | ]) 78 | .pipe(plumber({ 79 | errorHandler: onError 80 | })) 81 | .pipe(scsslint({ 82 | 'config': '.scss_lint.yml' 83 | })); 84 | }); 85 | 86 | gulp.task('modernizr', function () { 87 | return gulp.src([paths.js + '/**/*.js']) 88 | .pipe(plumber({ 89 | errorHandler: onError 90 | })) 91 | .pipe(modernizr({ 92 | 'options': [ 93 | 'setClasses', 'addTest', 'html5printshiv', 'testProp', 'fnBind' 94 | ], 95 | 'tests': ['objectfit', 'flexbox'] 96 | })) 97 | .pipe(uglify()) 98 | .pipe(gulp.dest(paths.buildJs)) 99 | }); 100 | 101 | var jsFiles = [ 102 | paths.npm + '/fastclick/lib/fastclick.js', 103 | paths.npm + '/svg4everybody/dist/svg4everybody.min.js', 104 | paths.npm + '/picturefill/dist/picturefill.min.js', 105 | paths.npm + '/jquery/dist/jquery.js', 106 | paths.npm + '/bengor-cookies/dist/bengor-cookies.js', 107 | //paths.npm + '/foundation-sites/dist/foundation.js', 108 | paths.js + '/**/*.js' 109 | ]; 110 | 111 | gulp.task('js', ['modernizr'], function () { 112 | gulp.src(jsFiles) 113 | .pipe(plumber({ 114 | errorHandler: onError 115 | })) 116 | .pipe(gulp.dest(paths.buildJs)); 117 | }); 118 | 119 | gulp.task('js:prod', ['modernizr'], function () { 120 | gulp.src(jsFiles) 121 | .pipe(plumber({ 122 | errorHandler: onError 123 | })) 124 | .pipe(concat('app.min.js')) 125 | .pipe(uglify()) 126 | .pipe(gulp.dest(paths.buildJs)); 127 | }); 128 | 129 | gulp.task('sprites', function () { 130 | return gulp.src(paths.svg + '/*.svg') 131 | .pipe(plumber({ 132 | errorHandler: onError 133 | })) 134 | .pipe(svgSprite({ 135 | mode: { 136 | symbol: { 137 | dest: '', 138 | sprite: 'symbols', 139 | example: {dest: 'symbols'} 140 | } 141 | } 142 | })) 143 | .pipe(gulp.dest(paths.buildSvg)); 144 | }); 145 | 146 | gulp.task('watch', ['sass', 'js:prod'], function () { 147 | livereload.listen(); 148 | gulp.watch(paths.sass + '/**/*.scss', ['sass']); 149 | gulp.watch(paths.js + '/**/*.js', ['js:prod']); 150 | gulp.watch(paths.svg + '/**/*.js', ['sprites']); 151 | }); 152 | 153 | gulp.task('default', ['sass', 'modernizr', 'js', 'sprites', 'watch']); 154 | 155 | gulp.task('prod', ['sass:prod', 'modernizr', 'js:prod', 'sprites']); 156 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "symfony-standard", 3 | "main": "gulpfile.js", 4 | "author": "LIN3S", 5 | "dependencies": { 6 | "bengor-cookies": "^0.4.0", 7 | "fastclick": "^1.0.6", 8 | "foundation-sites": "^6.2.3", 9 | "picturefill": "^3.0.2", 10 | "svg4everybody": "^2.1.0" 11 | }, 12 | "devDependencies": { 13 | "gulp": "^3.9.0", 14 | "gulp-concat": "^2.6.0", 15 | "gulp-cssnano": "^2.1.0", 16 | "gulp-livereload": "^3.8.1", 17 | "gulp-modernizr": "0.0.0", 18 | "gulp-plumber": "^1.1.0", 19 | "gulp-postcss": "^6.1.0", 20 | "gulp-rename": "^1.2.2", 21 | "gulp-sass": "^2.3.0", 22 | "gulp-scss-lint": "^0.4.0", 23 | "gulp-svg-sprite": "^1.3.1", 24 | "gulp-uglify": "^1.5.0", 25 | "postcss-cssnext": "^2.7.0" 26 | }, 27 | "scripts": { 28 | "phoenix": "rm -rf node_modules && npm install" 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/.htaccess.dist: -------------------------------------------------------------------------------- 1 | # This file is part of the Symfony Standard project. 2 | # 3 | # Copyright (c) 2016 LIN3S 4 | # 5 | # For the full copyright and license information, please view the LICENSE 6 | # file that was distributed with this source code. 7 | # 8 | # @author Jon Torrado 9 | # @author Beñat Espiña 10 | 11 | 12 | Require all denied 13 | 14 | 15 | Order deny,allow 16 | Deny from all 17 | 18 | -------------------------------------------------------------------------------- /src/AppBundle/AppBundle.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 | namespace AppBundle; 13 | 14 | use Symfony\Component\HttpKernel\Bundle\Bundle; 15 | 16 | /** 17 | * Bundle's kernel class. 18 | * 19 | * @author Jon Torrado 20 | * @author Beñat Espiña 21 | */ 22 | class AppBundle extends Bundle 23 | { 24 | } 25 | -------------------------------------------------------------------------------- /src/AppBundle/Controller/DefaultController.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 | namespace AppBundle\Controller; 13 | 14 | use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method; 15 | use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route; 16 | use Symfony\Bundle\FrameworkBundle\Controller\Controller; 17 | 18 | /** 19 | * Default controller class. 20 | * 21 | * @author Jon Torrado 22 | * @author Beñat Espiña 23 | */ 24 | class DefaultController extends Controller 25 | { 26 | /** 27 | * Index action. 28 | * 29 | * @Route("/", name="homepage") 30 | * @Method("GET") 31 | * 32 | * @return \Symfony\Component\HttpFoundation\Response 33 | */ 34 | public function indexAction() 35 | { 36 | // replace this example code with whatever you need 37 | return $this->render('default/index.html.twig', array( 38 | 'base_dir' => realpath($this->container->getParameter('kernel.root_dir').'/..'), 39 | )); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/AppBundle/DependencyInjection/AppExtension.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 | namespace AppBundle\DependencyInjection; 13 | 14 | use Symfony\Component\Config\FileLocator; 15 | use Symfony\Component\DependencyInjection\ContainerBuilder; 16 | use Symfony\Component\DependencyInjection\Loader; 17 | use Symfony\Component\HttpKernel\DependencyInjection\Extension; 18 | 19 | /** 20 | * This is the class that loads and manages your bundle configuration. 21 | * 22 | * @author Jon Torrado 23 | */ 24 | class AppExtension extends Extension 25 | { 26 | /** 27 | * {@inheritdoc} 28 | */ 29 | public function load(array $configs, ContainerBuilder $container) 30 | { 31 | $loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config')); 32 | $loader->load('services.yml'); 33 | $loader->load('admin.yml'); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/AppBundle/Resources/config/admin.yml: -------------------------------------------------------------------------------- 1 | # This file is part of the Symfony Standard project. 2 | # 3 | # Copyright (c) 2016 LIN3S 4 | # 5 | # For the full copyright and license information, please view the LICENSE 6 | # file that was distributed with this source code. 7 | # 8 | # @author Jon Torrado 9 | 10 | # Learn more about admin services at 11 | # https://sonata-project.org/bundles/admin/3-x/doc/getting_started/creating_an_admin.html#step-3-register-the-admin-class 12 | services: 13 | # sonata.admin.post: 14 | # class: AppBundle\Admin\PostAdmin 15 | # arguments: [~, AppBundle\Entity\Post, ~] 16 | # tags: 17 | # - { name: sonata.admin, manager_type: orm, group: Content, label: Post } 18 | #Use this if you want translated admin 19 | # calls: 20 | # - [ setLabelTranslatorStrategy, ["@sonata.admin.label.strategy.underscore"]] 21 | -------------------------------------------------------------------------------- /src/AppBundle/Resources/config/services.yml: -------------------------------------------------------------------------------- 1 | # This file is part of the Symfony Standard project. 2 | # 3 | # Copyright (c) 2016 LIN3S 4 | # 5 | # For the full copyright and license information, please view the LICENSE 6 | # file that was distributed with this source code. 7 | # 8 | # @author Jon Torrado 9 | 10 | # Learn more about services, parameters and containers at 11 | # http://symfony.com/doc/current/book/service_container.html 12 | parameters: 13 | # parameter_name: value 14 | 15 | services: 16 | # service_name: 17 | # class: AppBundle\Directory\ClassName 18 | # arguments: ["@another_service_name", "plain_value", "%parameter_name%"] 19 | -------------------------------------------------------------------------------- /src/Application/Sonata/UserBundle/Admin/UserAdmin.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 | namespace Application\Sonata\UserBundle\Admin; 13 | 14 | use Sonata\AdminBundle\Datagrid\ListMapper; 15 | use Sonata\AdminBundle\Form\FormMapper; 16 | use Sonata\UserBundle\Admin\Entity\UserAdmin as BaseUserAdmin; 17 | 18 | /** 19 | * Modifies Sonata Admin default User admin screens. 20 | * 21 | * @author Jon Torrado 22 | */ 23 | class UserAdmin extends BaseUserAdmin 24 | { 25 | protected function configureFormFields(FormMapper $formMapper) 26 | { 27 | parent::configureFormFields($formMapper); 28 | } 29 | 30 | protected function configureListFields(ListMapper $listMapper) 31 | { 32 | parent::configureListFields($listMapper); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/Application/Sonata/UserBundle/ApplicationSonataUserBundle.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 | namespace Application\Sonata\UserBundle; 13 | 14 | use Symfony\Component\HttpKernel\Bundle\Bundle; 15 | 16 | /** 17 | * Application Sonata user Bundle's kernel class. 18 | * 19 | * @author Jon Torrado 20 | */ 21 | class ApplicationSonataUserBundle extends Bundle 22 | { 23 | /** 24 | * {@inheritdoc} 25 | */ 26 | public function getParent() 27 | { 28 | return 'SonataUserBundle'; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Application/Sonata/UserBundle/DataFixtures/ORM/LoadUserData.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 | namespace Application\Sonata\UserBundle\DataFixtures\ORM; 13 | 14 | use Doctrine\Common\DataFixtures\AbstractFixture; 15 | use Doctrine\Common\DataFixtures\OrderedFixtureInterface; 16 | use Doctrine\Common\Persistence\ObjectManager; 17 | use Symfony\Component\DependencyInjection\ContainerAwareInterface; 18 | use Symfony\Component\DependencyInjection\ContainerInterface; 19 | 20 | /** 21 | * Loads users to the database. 22 | * 23 | * @author Jon Torrado 24 | */ 25 | class LoadUserData extends AbstractFixture implements ContainerAwareInterface, OrderedFixtureInterface 26 | { 27 | private static $names = [ 28 | 'Tricia Carbonneau', 29 | 'Cindy Mendoza', 30 | 'Alessandra Wollard', 31 | 'Vernell Fleeman', 32 | 'Chad Ferebee', 33 | 'Olinda Resendez', 34 | 'Iva Moniz', 35 | 'Alec Cuthbertson', 36 | 'Candie Foret', 37 | 'Burma Stgermain', 38 | 'Rosaline Spiegel', 39 | 'Elois Hipsher', 40 | 'Fleta Hatter', 41 | 'Jordan Muirhead', 42 | 'Shala Thrift', 43 | 'Dannette Newell', 44 | 'Brett Voigt', 45 | 'Lesley Varney', 46 | 'Rich Larocca', 47 | 'Ofelia Deckert', 48 | 'Tamera Bagdon', 49 | 'Kecia Buttner', 50 | 'Bronwyn Mattia', 51 | 'Brooks Mcpartland', 52 | 'Candelaria Buechner', 53 | 'Yolando Dery', 54 | 'Daniele Guan', 55 | 'Ehtel Durrant', 56 | 'Rocco Medlen', 57 | 'Sally Cornejo', 58 | 'Dorinda Riser', 59 | 'Tana Berthiaume', 60 | 'Clelia Senger', 61 | 'Norbert Petteway', 62 | 'Agatha Gaus', 63 | 'Lauran Depaolo', 64 | 'Treasa Waid', 65 | 'Truman Sybert', 66 | 'Annmarie Helt', 67 | 'Librada Mistretta', 68 | 'Kristan Mount', 69 | 'Gertha Hines', 70 | 'Ashley Mangual', 71 | 'Florrie Hallford', 72 | 'Pricilla Weekes', 73 | 'Celestine Boelter', 74 | 'Chas Manross', 75 | 'Elvie Glavin', 76 | 'Rolanda Mcspadden', 77 | 'Kimberlee Wood', 78 | ]; 79 | 80 | private $container; 81 | 82 | public function setContainer(ContainerInterface $container = null) 83 | { 84 | $this->container = $container; 85 | } 86 | 87 | /** 88 | * @return \FOS\UserBundle\Model\UserManagerInterface 89 | */ 90 | public function getUserManager() 91 | { 92 | return $this->container->get('fos_user.user_manager'); 93 | } 94 | 95 | public function load(ObjectManager $manager) 96 | { 97 | $manager = $this->getUserManager(); 98 | 99 | // Create admin user 100 | $user = $manager->createUser(); 101 | $user->setUsername('admin'); 102 | $user->setEmail('admin@localhost'); 103 | $user->setPlainPassword('admin'); 104 | $user->setEnabled(true); 105 | $user->setSuperAdmin(true); 106 | $user->setLocked(false); 107 | 108 | $manager->updateUser($user); 109 | 110 | // Create some random users 111 | foreach (self::$names as $name) { 112 | $user = $manager->createUser(); 113 | list($firstName, $lastName) = explode(' ', $name); 114 | $user->setUsername(strtolower($firstName)); 115 | $user->setEmail($firstName . '@localhost'); 116 | $user->setPlainPassword($firstName); 117 | $user->setFirstName($firstName); 118 | $user->setLastName($lastName); 119 | $user->setEnabled(true); 120 | $user->setLocked(false); 121 | 122 | $manager->updateUser($user); 123 | } 124 | } 125 | 126 | public function getOrder() 127 | { 128 | return 1; 129 | } 130 | } 131 | -------------------------------------------------------------------------------- /src/Application/Sonata/UserBundle/Document/Group.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 | namespace Application\Sonata\UserBundle\Document; 13 | 14 | use Sonata\UserBundle\Document\BaseGroup as BaseGroup; 15 | 16 | /** 17 | * Custom group class that extends Sonata's document group class. 18 | * 19 | * @author Jon Torrado 20 | * @author Beñat Espiña 21 | */ 22 | class Group extends BaseGroup 23 | { 24 | } 25 | -------------------------------------------------------------------------------- /src/Application/Sonata/UserBundle/Document/User.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 | namespace Application\Sonata\UserBundle\Document; 13 | 14 | use Sonata\UserBundle\Document\BaseUser as BaseUser; 15 | 16 | /** 17 | * Custom user class that extends Sonata's document user class. 18 | * 19 | * @author Jon Torrado 20 | * @author Beñat Espiña 21 | */ 22 | class User extends BaseUser 23 | { 24 | } 25 | -------------------------------------------------------------------------------- /src/Application/Sonata/UserBundle/Entity/Group.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 | namespace Application\Sonata\UserBundle\Entity; 13 | 14 | use Sonata\UserBundle\Entity\BaseGroup as BaseGroup; 15 | 16 | /** 17 | * Custom group class that extends Sonata's entity group class. 18 | * 19 | * @author Jon Torrado 20 | * @author Beñat Espiña 21 | */ 22 | class Group extends BaseGroup 23 | { 24 | } 25 | -------------------------------------------------------------------------------- /src/Application/Sonata/UserBundle/Entity/User.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 | namespace Application\Sonata\UserBundle\Entity; 13 | 14 | use Sonata\UserBundle\Entity\BaseUser as BaseUser; 15 | 16 | /** 17 | * Custom user class that extends Sonata's entity user class. 18 | * 19 | * @author Jon Torrado 20 | * @author Beñat Espiña 21 | */ 22 | class User extends BaseUser 23 | { 24 | } 25 | -------------------------------------------------------------------------------- /src/Application/Sonata/UserBundle/Resources/config/doctrine/Group.mongodb.yml: -------------------------------------------------------------------------------- 1 | # This file is part of the Symfony Standard project. 2 | # 3 | # Copyright (c) 2016 LIN3S 4 | # 5 | # For the full copyright and license information, please view the LICENSE 6 | # file that was distributed with this source code. 7 | # 8 | # @author Jon Torrado 9 | 10 | Application\Sonata\UserBundle\Document\Group: 11 | type: document 12 | collection: fos_user_group 13 | fields: 14 | id: 15 | id: true 16 | strategy: INCREMENT 17 | -------------------------------------------------------------------------------- /src/Application/Sonata/UserBundle/Resources/config/doctrine/Group.orm.yml: -------------------------------------------------------------------------------- 1 | # This file is part of the Symfony Standard project. 2 | # 3 | # Copyright (c) 2016 LIN3S 4 | # 5 | # For the full copyright and license information, please view the LICENSE 6 | # file that was distributed with this source code. 7 | # 8 | # @author Jon Torrado 9 | 10 | Application\Sonata\UserBundle\Entity\Group: 11 | type: entity 12 | table: fos_user_group 13 | id: 14 | id: 15 | type: integer 16 | generator: { strategy: AUTO } 17 | -------------------------------------------------------------------------------- /src/Application/Sonata/UserBundle/Resources/config/doctrine/User.mongodb.yml: -------------------------------------------------------------------------------- 1 | # This file is part of the Symfony Standard project. 2 | # 3 | # Copyright (c) 2016 LIN3S 4 | # 5 | # For the full copyright and license information, please view the LICENSE 6 | # file that was distributed with this source code. 7 | # 8 | # @author Jon Torrado 9 | 10 | Application\Sonata\UserBundle\Document\User: 11 | type: document 12 | collection: fos_user_user 13 | customId: true 14 | fields: 15 | id: 16 | id: true 17 | strategy: INCREMENT 18 | -------------------------------------------------------------------------------- /src/Application/Sonata/UserBundle/Resources/config/doctrine/User.orm.yml: -------------------------------------------------------------------------------- 1 | # This file is part of the Symfony Standard project. 2 | # 3 | # Copyright (c) 2016 LIN3S 4 | # 5 | # For the full copyright and license information, please view the LICENSE 6 | # file that was distributed with this source code. 7 | # 8 | # @author Jon Torrado 9 | 10 | Application\Sonata\UserBundle\Entity\User: 11 | type: entity 12 | table: fos_user_user 13 | id: 14 | id: 15 | type: integer 16 | generator: { strategy: AUTO } 17 | -------------------------------------------------------------------------------- /src/Application/Sonata/UserBundle/Resources/config/serializer/Document.Group.yml: -------------------------------------------------------------------------------- 1 | # This file is part of the Symfony Standard project. 2 | # 3 | # Copyright (c) 2016 LIN3S 4 | # 5 | # For the full copyright and license information, please view the LICENSE 6 | # file that was distributed with this source code. 7 | # 8 | # @author Jon Torrado 9 | 10 | Application\Sonata\UserBundle\Document\Group: 11 | exclusion_policy: ALL 12 | xml_root_name: _group 13 | properties: 14 | id: 15 | xml_attribute_map: true 16 | type: integer 17 | expose: true 18 | since_version: 1.0 19 | groups: [sonata_api_read, sonata_api_write, sonata_search] 20 | -------------------------------------------------------------------------------- /src/Application/Sonata/UserBundle/Resources/config/serializer/Document.User.yml: -------------------------------------------------------------------------------- 1 | # This file is part of the Symfony Standard project. 2 | # 3 | # Copyright (c) 2016 LIN3S 4 | # 5 | # For the full copyright and license information, please view the LICENSE 6 | # file that was distributed with this source code. 7 | # 8 | # @author Jon Torrado 9 | 10 | Application\Sonata\UserBundle\Document\User: 11 | exclusion_policy: ALL 12 | xml_root_name: _group 13 | properties: 14 | id: 15 | xml_attribute_map: true 16 | type: integer 17 | expose: true 18 | since_version: 1.0 19 | groups: [sonata_api_read, sonata_api_write, sonata_search] 20 | -------------------------------------------------------------------------------- /src/Application/Sonata/UserBundle/Resources/config/serializer/Entity.Group.yml: -------------------------------------------------------------------------------- 1 | # This file is part of the Symfony Standard project. 2 | # 3 | # Copyright (c) 2016 LIN3S 4 | # 5 | # For the full copyright and license information, please view the LICENSE 6 | # file that was distributed with this source code. 7 | # 8 | # @author Jon Torrado 9 | 10 | Application\Sonata\UserBundle\Entity\Group: 11 | exclusion_policy: ALL 12 | xml_root_name: _group 13 | properties: 14 | id: 15 | xml_attribute_map: true 16 | type: integer 17 | expose: true 18 | since_version: 1.0 19 | groups: [sonata_api_read, sonata_api_write, sonata_search] 20 | -------------------------------------------------------------------------------- /src/Application/Sonata/UserBundle/Resources/config/serializer/Entity.User.yml: -------------------------------------------------------------------------------- 1 | # This file is part of the Symfony Standard project. 2 | # 3 | # Copyright (c) 2016 LIN3S 4 | # 5 | # For the full copyright and license information, please view the LICENSE 6 | # file that was distributed with this source code. 7 | # 8 | # @author Jon Torrado 9 | 10 | Application\Sonata\UserBundle\Entity\User: 11 | exclusion_policy: ALL 12 | xml_root_name: _user 13 | properties: 14 | id: 15 | xml_attribute_map: true 16 | type: integer 17 | expose: true 18 | since_version: 1.0 19 | groups: [sonata_api_read, sonata_api_write, sonata_search] 20 | -------------------------------------------------------------------------------- /web/.htaccess.dist: -------------------------------------------------------------------------------- 1 | # This file is part of the Symfony Standard project. 2 | # 3 | # Copyright (c) 2016 LIN3S 4 | # 5 | # For the full copyright and license information, please view the LICENSE 6 | # file that was distributed with this source code. 7 | # 8 | # @author Jon Torrado 9 | # @author Beñat Espiña 10 | 11 | # Use the front controller as index file. It serves as a fallback solution when 12 | # every other rewrite/redirect fails (e.g. in an aliased environment without 13 | # mod_rewrite). Additionally, this reduces the matching process for the 14 | # start page (path "/") because otherwise Apache will apply the rewriting rules 15 | # to each configured DirectoryIndex file (e.g. index.php, index.html, index.pl). 16 | DirectoryIndex app.php 17 | 18 | # By default, Apache does not evaluate symbolic links if you did not enable this 19 | # feature in your server configuration. Uncomment the following line if you 20 | # install assets as symlinks or if you experience problems related to symlinks 21 | # when compiling LESS/Sass/CoffeScript assets. 22 | # Options FollowSymlinks 23 | 24 | # Disabling MultiViews prevents unwanted negotiation, e.g. "/app" should not resolve 25 | # to the front controller "/app.php" but be rewritten to "/app.php/app". 26 | 27 | Options -MultiViews 28 | 29 | 30 | 31 | RewriteEngine On 32 | 33 | # Determine the RewriteBase automatically and set it as environment variable. 34 | # If you are using Apache aliases to do mass virtual hosting or installed the 35 | # project in a subdirectory, the base path will be prepended to allow proper 36 | # resolution of the app.php file and to redirect to the correct URI. It will 37 | # work in environments without path prefix as well, providing a safe, one-size 38 | # fits all solution. But as you do not need it in this case, you can comment 39 | # the following 2 lines to eliminate the overhead. 40 | RewriteCond %{REQUEST_URI}::$1 ^(/.+)/(.*)::\2$ 41 | RewriteRule ^(.*) - [E=BASE:%1] 42 | 43 | # Sets the HTTP_AUTHORIZATION header removed by apache 44 | RewriteCond %{HTTP:Authorization} . 45 | RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}] 46 | 47 | # Redirect to URI without front controller to prevent duplicate content 48 | # (with and without `/app.php`). Only do this redirect on the initial 49 | # rewrite by Apache and not on subsequent cycles. Otherwise we would get an 50 | # endless redirect loop (request -> rewrite to front controller -> 51 | # redirect -> request -> ...). 52 | # So in case you get a "too many redirects" error or you always get redirected 53 | # to the start page because your Apache does not expose the REDIRECT_STATUS 54 | # environment variable, you have 2 choices: 55 | # - disable this feature by commenting the following 2 lines or 56 | # - use Apache >= 2.3.9 and replace all L flags by END flags and remove the 57 | # following RewriteCond (best solution) 58 | RewriteCond %{ENV:REDIRECT_STATUS} ^$ 59 | RewriteRule ^app\.php(/(.*)|$) %{ENV:BASE}/$2 [R=301,L] 60 | 61 | # If the requested filename exists, simply serve it. 62 | # We only want to let Apache serve files and not directories. 63 | RewriteCond %{REQUEST_FILENAME} -f 64 | RewriteRule .? - [L] 65 | 66 | # Rewrite all other queries to the front controller. 67 | RewriteRule .? %{ENV:BASE}/app.php [L] 68 | 69 | 70 | 71 | 72 | # When mod_rewrite is not available, we instruct a temporary redirect of 73 | # the start page to the front controller explicitly so that the website 74 | # and the generated links can still be used. 75 | RedirectMatch 302 ^/$ /app.php/ 76 | # RedirectTemp cannot be used instead 77 | 78 | 79 | -------------------------------------------------------------------------------- /web/app.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 | * @author Jon Torrado 12 | * @author Beñat Espiña 13 | */ 14 | 15 | use Symfony\Component\HttpFoundation\Request; 16 | 17 | /** 18 | * @var Composer\Autoload\ClassLoader 19 | */ 20 | $loader = require __DIR__.'/../app/autoload.php'; 21 | include_once __DIR__.'/../app/bootstrap.php.cache'; 22 | 23 | // Enable APC for autoloading to improve performance. 24 | // You should change the ApcClassLoader first argument to a unique prefix 25 | // in order to prevent cache key conflicts with other applications 26 | // also using APC. 27 | 28 | // See: https://github.com/symfony/symfony-standard/blob/2.8/web/app.php 29 | 30 | require_once __DIR__ . '/../app/AppKernel.php'; 31 | 32 | $kernel = new AppKernel('prod', false); 33 | $kernel->loadClassCache(); 34 | 35 | // When using the HttpCache, you need to call the method in your front controller instead of relying on the configuration parameter 36 | // https://github.com/symfony/symfony-standard/blob/2.8/web/app.php 37 | $request = Request::createFromGlobals(); 38 | $response = $kernel->handle($request); 39 | $response->send(); 40 | $kernel->terminate($request, $response); 41 | -------------------------------------------------------------------------------- /web/app_dev.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 | * @author Jon Torrado 12 | * @author Beñat Espiña 13 | */ 14 | 15 | use Symfony\Component\HttpFoundation\Request; 16 | use Symfony\Component\Debug\Debug; 17 | 18 | if (isset($_SERVER['HTTP_CLIENT_IP']) 19 | || isset($_SERVER['HTTP_X_FORWARDED_FOR']) 20 | || !(in_array(@$_SERVER['REMOTE_ADDR'], ['127.0.0.1', 'fe80::1', '::1']) || php_sapi_name() === 'cli-server') 21 | ) { 22 | header('HTTP/1.0 403 Forbidden'); 23 | exit('You are not allowed to access this file. Check ' . basename(__FILE__) . ' for more information.'); 24 | } 25 | 26 | /** 27 | * @var Composer\Autoload\ClassLoader $loader 28 | */ 29 | $loader = require __DIR__.'/../app/autoload.php'; 30 | Debug::enable(); 31 | $kernel = new AppKernel('dev', true); 32 | $kernel->loadClassCache(); 33 | $request = Request::createFromGlobals(); 34 | $response = $kernel->handle($request); 35 | $response->send(); 36 | $kernel->terminate($request, $response); 37 | -------------------------------------------------------------------------------- /web/apple-touch-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LIN3S/SymfonyStandard/425eda1e19b20404708d6531b6966cd3ef740bfa/web/apple-touch-icon.png -------------------------------------------------------------------------------- /web/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LIN3S/SymfonyStandard/425eda1e19b20404708d6531b6966cd3ef740bfa/web/favicon.ico -------------------------------------------------------------------------------- /web/robots.txt: -------------------------------------------------------------------------------- 1 | # This file is part of the Symfony Standard project. 2 | # 3 | # Copyright (c) 2016 LIN3S 4 | # 5 | # For the full copyright and license information, please view the LICENSE 6 | # file that was distributed with this source code. 7 | # 8 | # @author Iñaki Gorostiza 9 | 10 | User-agent: * 11 | Disallow: / 12 | --------------------------------------------------------------------------------