Skip to content

Commit

Permalink
Add initial set of files
Browse files Browse the repository at this point in the history
  • Loading branch information
Boyquotes committed Jul 27, 2020
0 parents commit 0581b0d
Show file tree
Hide file tree
Showing 188 changed files with 31,684 additions and 0 deletions.
10 changes: 10 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
; top-most EditorConfig file
root = true

; Unix-style newlines
[*]
end_of_line = LF

[*.php]
indent_style = space
indent_size = 4
33 changes: 33 additions & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# In all environments, the following files are loaded if they exist,
# the latter taking precedence over the former:
#
# * .env contains default values for the environment variables needed by the app
# * .env.local uncommitted file with local overrides
# * .env.$APP_ENV committed environment-specific defaults
# * .env.$APP_ENV.local uncommitted environment-specific overrides
#
# Real environment variables win over .env files.
#
# DO NOT DEFINE PRODUCTION SECRETS IN THIS FILE NOR IN ANY OTHER COMMITTED FILES.
#
# Run "composer dump-env prod" to compile .env files for production use (requires symfony/flex >=1.2).
# https://symfony.com/doc/current/best_practices.html#use-environment-variables-for-infrastructure-configuration

###> symfony/framework-bundle ###
APP_ENV=dev
APP_SECRET=2ca64f8d83b9e89f5f19d672841d6bb8
#TRUSTED_PROXIES=127.0.0.0/8,10.0.0.0/8,172.16.0.0/12,192.168.0.0/16
#TRUSTED_HOSTS='^(localhost|example\.com)$'
###< symfony/framework-bundle ###

###> doctrine/doctrine-bundle ###
# Format described at https://www.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/configuration.html#connecting-using-a-url
# For a MySQL database, use: "mysql://db_user:[email protected]:3306/db_name"
# For a PostgreSQL database, use: "postgresql://db_user:[email protected]:5432/db_name?serverVersion=11&charset=utf8"
# IMPORTANT: You MUST configure your server version, either here or in config/packages/doctrine.yaml
DATABASE_URL=sqlite:///%kernel.project_dir%/data/database.sqlite
###< doctrine/doctrine-bundle ###

###> symfony/mailer ###
# MAILER_DSN=smtp://localhost
###< symfony/mailer ###
6 changes: 6 additions & 0 deletions .env.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# define your env variables for the test env here
KERNEL_CLASS='App\Kernel'
APP_SECRET='$ecretf0rt3st'
SYMFONY_DEPRECATIONS_HELPER=999999
PANTHER_APP_ENV=panther
DATABASE_URL=sqlite:///%kernel.project_dir%/data/database_test.sqlite
29 changes: 29 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/public/build/fonts/glyphicons-*
/public/build/images/glyphicons-*

###> symfony/framework-bundle ###
/.env.local
/.env.local.php
/.env.*.local
/config/secrets/prod/prod.decrypt.private.php
/public/bundles/
/var/
/vendor/
###< symfony/framework-bundle ###

###> symfony/phpunit-bridge ###
.phpunit
.phpunit.result.cache
/phpunit.xml
###< symfony/phpunit-bridge ###
###> friendsofphp/php-cs-fixer ###
/.php_cs
/.php_cs.cache
###< friendsofphp/php-cs-fixer ###

###> symfony/webpack-encore-bundle ###
/node_modules/
/public/build/
npm-debug.log
yarn-error.log
###< symfony/webpack-encore-bundle ###
46 changes: 46 additions & 0 deletions .php_cs.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<?php

$fileHeaderComment = <<<COMMENT
This file is part of the Symfony package.
(c) Fabien Potencier <[email protected]>
For the full copyright and license information, please view the LICENSE
file that was distributed with this source code.
COMMENT;

$finder = PhpCsFixer\Finder::create()
->in(__DIR__)
->exclude('config')
->exclude('var')
->exclude('public/bundles')
->exclude('public/build')
// exclude files generated by Symfony Flex recipes
->notPath('bin/console')
->notPath('public/index.php')
;

return PhpCsFixer\Config::create()
->setRiskyAllowed(true)
->setRules([
'@Symfony' => true,
'@Symfony:risky' => true,
'array_syntax' => ['syntax' => 'short'],
'header_comment' => ['header' => $fileHeaderComment, 'separate' => 'both'],
'linebreak_after_opening_tag' => true,
'mb_str_functions' => true,
'no_php4_constructor' => true,
'no_superfluous_phpdoc_tags' => true,
'no_unreachable_default_argument_value' => true,
'no_useless_else' => true,
'no_useless_return' => true,
'ordered_imports' => true,
'php_unit_strict' => true,
'phpdoc_order' => true,
'semicolon_after_instruction' => true,
'strict_comparison' => true,
'strict_param' => true,
])
->setFinder($finder)
->setCacheFile(__DIR__.'/var/.php_cs.cache')
;
84 changes: 84 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
# Ensure that PHP is installed in Travis' build environment. Travis provides several versions of
# PHP like 5.6, 7.0, 7.1, 7.2, 7.3, 7.4, etc., each of them including XDebug and PHPUnit.
language: php

# Travis can cache content between builds. This speeds up the build process and saves resources.
cache:
yarn: true
directories:
# Cache composer packages so "composer install" is faster.
- $HOME/.composer/cache/files
# Cache the directory where Symfony stores its slightly modified version of PHPUnit.
- ./bin/.phpunit
# Cache the Symfony binary's directory so that it does not have to be reinstalled.
- $HOME/.symfony

env:
global:
# Symfony's PHPUnit bridge provides a modified version of PHPUnit. The modified PHPUnit is
# written to a directory that can be configured by the SYMFONY_PHPUNIT_DIR env var, or in
# the same directory as the simple-phpunit if it is not provided. It's also possible to set
# this env var in the phpunit.xml.dist file.
- SYMFONY_PHPUNIT_DIR=./bin/.phpunit
- SYMFONY_DEPRECATIONS_HELPER=9
- ACTION="install"
# Add the Symfony binary's path to PATH.
- PATH="$HOME/.symfony/bin:$PATH"

# Defines all jobs which Travis will run in parallel. For each PHP version we support we will run one job.
jobs:
# With fast finishing enabled, Travis CI will mark your build as finished as soon as one of two
# conditions are met: The only remaining jobs are allowed to fail, or a job has already failed. In
# these cases, the status of the build can already be determined, so there’s no need to wait around
# until the other jobs finish.
fast_finish: true
include:
# Run tests with the dependencies from composer.lock
- php: 7.2
- php: 7.3
- php: 7.4

# Run tests against dev (currently 5.1.x-dev)
- php: 7.3
env: STABILITY=dev ACTION=update

# Run tests against dev-master (currently 5.2.x-dev)
- php: 7.3
env: STABILITY=dev SYMFONY=5.* ACTION=update

before_install:
- phpenv config-rm xdebug.ini || true
# Change minimum-stability to allow upcoming versions (dev | alpha | beta | RC)
- '[[ -z $STABILITY ]] || composer config minimum-stability "$STABILITY"'
# Change extra.symfony.require used by symfony flex
- '[[ -z $SYMFONY ]] || composer config extra.symfony.require "$SYMFONY"'
# If it is available update the Symfony binary, if not install it.
- if symfony self:version; then symfony self:update --yes ; else wget https://get.symfony.com/cli/installer -O - | bash ; fi

install:
- php -r "echo ini_get('memory_limit').PHP_EOL;"
# Install or update Composer packages including dev dependencies listed in require-dev.
- COMPOSER_MEMORY_LIMIT=-1 composer $ACTION
- ./bin/phpunit install

script:
# There's no need to load data fixtures before running tests because the project
# repository already includes a test database with all the fixtures needed to run the tests.
- ./bin/phpunit
# This checks that the source code follows the Symfony Code Syntax rules.
- '[[ $TRAVIS_PHP_VERSION != "7.4" ]] || ./vendor/bin/php-cs-fixer fix --diff --dry-run -v'
# This checks that the YAML config files contain no syntax errors.
- ./bin/console lint:yaml config --parse-tags
# This checks that the Twig template files contain no syntax errors.
- ./bin/console lint:twig templates --env=prod
# This checks that the XLIFF translations contain no syntax errors.
- ./bin/console lint:xliff translations
# This checks that arguments injected into services match type declarations.
- ./bin/console lint:container
# This checks that the application doesn't use dependencies with known security vulnerabilities.
- symfony check:security
# This checks that Doctrine's mapping configurations are valid.
- ./bin/console doctrine:schema:validate --skip-sync -vvv --no-interaction
# Fail CI if the repo is in a dirty state after building assets (only for current release ie install).
#- if [[ "$ACTION" == "install" ]]; then yarn install && yarn encore production && git add --all && git diff --staged --exit-code; fi
- composer validate --strict
7 changes: 7 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Contributing
============

The Symfony Demo application is an open source project. Contributions made by
the community are welcome. Send us your ideas, code reviews, pull requests and
feature requests to help us improve this project. All contributions must follow
the [usual Symfony contribution requirements](https://symfony.com/doc/current/contributing/index.html).
19 changes: 19 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
Copyright (c) 2015-2020 Fabien Potencier

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is furnished
to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
60 changes: 60 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
Symfony Demo Application
========================

The "Symfony Demo Application" is a reference application created to show how
to develop applications following the [Symfony Best Practices][1].

Requirements
------------

* PHP 7.2.9 or higher;
* PDO-SQLite PHP extension enabled;
* and the [usual Symfony application requirements][2].

Installation
------------

[Download Symfony][4] to install the `symfony` binary on your computer and run
this command:

```bash
$ symfony new --demo my_project
```

Alternatively, you can use Composer:

```bash
$ composer create-project symfony/symfony-demo my_project
```

Usage
-----

There's no need to configure anything to run the application. If you have
[installed Symfony][4] binary, run this command:

```bash
$ cd my_project/
$ symfony serve
```

Then access the application in your browser at the given URL (<https://localhost:8000> by default).

If you don't have the Symfony binary installed, run `php -S localhost:8000 -t public/`
to use the built-in PHP web server or [configure a web server][3] like Nginx or
Apache to run the application.

Tests
-----

Execute this command to run tests:

```bash
$ cd my_project/
$ ./bin/phpunit
```

[1]: https://symfony.com/doc/current/best_practices.html
[2]: https://symfony.com/doc/current/reference/requirements.html
[3]: https://symfony.com/doc/current/cookbook/configuration/web_server_configuration.html
[4]: https://symfony.com/download
54 changes: 54 additions & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
build: false
clone_depth: 1
clone_folder: c:\projects\symfony-demo

cache:
- '%LOCALAPPDATA%\Composer\files'
- '%LOCALAPPDATA%\SymfonyBridge\phpunit'
- c:\projects\symfony-demo\composer.phar

init:
- SET PATH=c:\php;%PATH%
- SET COMPOSER_NO_INTERACTION=1
- SET SYMFONY_DEPRECATIONS_HELPER=strict
- SET SYMFONY_PHPUNIT_DIR=%LOCALAPPDATA%\SymfonyBridge\phpunit
- SET ANSICON=121x90 (121x90)
- REG ADD "HKEY_CURRENT_USER\Software\Microsoft\Command Processor" /v DelayedExpansion /t REG_DWORD /d 1 /f

install:
- mkdir c:\php && cd c:\php
- appveyor DownloadFile https://raw.githubusercontent.com/symfony/binary-utils/master/cacert.pem
- appveyor DownloadFile https://github.com/symfony/binary-utils/releases/download/v0.1/php-7.1.3-Win32-VC14-x86.zip
- 7z x php-7.1.3-Win32-VC14-x86.zip -y >nul
- del /Q *.zip
- cd ext
- appveyor DownloadFile https://github.com/symfony/binary-utils/releases/download/v0.1/php_apcu-5.1.8-7.1-ts-vc14-x86.zip
- 7z x php_apcu-5.1.8-7.1-ts-vc14-x86.zip -y >nul
- del /Q *.zip
- cd ..
- copy /Y php.ini-development php.ini
- echo max_execution_time=1200 >> php.ini
- echo date.timezone="America/Los_Angeles" >> php.ini
- echo extension_dir=ext >> php.ini
- echo zend_extension=php_opcache.dll >> php.ini
- echo opcache.enable_cli=1 >> php.ini
- echo extension=php_openssl.dll >> php.ini
- echo extension=php_apcu.dll >> php.ini
- echo apc.enable_cli=1 >> php.ini
- echo extension=php_intl.dll >> php.ini
- echo extension=php_mbstring.dll >> php.ini
- echo extension=php_fileinfo.dll >> php.ini
- echo extension=php_pdo_sqlite.dll >> php.ini
- echo extension=php_curl.dll >> php.ini
- echo curl.cainfo=c:\php\cacert.pem >> php.ini
- cd c:\projects\symfony-demo
- IF NOT EXIST composer.phar (appveyor DownloadFile https://getcomposer.org/download/1.3.0/composer.phar)
- php composer.phar self-update
- IF %APPVEYOR_REPO_BRANCH%==master (SET COMPOSER_ROOT_VERSION=dev-master) ELSE (SET COMPOSER_ROOT_VERSION=%APPVEYOR_REPO_BRANCH%.x-dev)
- php composer.phar update --no-progress --ansi
- SET COMPOSER_ROOT_VERSION=
- vendor\bin\simple-phpunit install

test_script:
- cd c:\projects\symfony-demo
- vendor/bin/simple-phpunit
Loading

0 comments on commit 0581b0d

Please sign in to comment.