Initial commit with Symfony 2.1+Vendors
Signed-off-by: Gergely POLONKAI (W00d5t0ck) <polesz@w00d5t0ck.info>master
commit
082a0130c2
@ -0,0 +1,19 @@
|
||||
Copyright (c) 2004-2012 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.
|
@ -0,0 +1,174 @@
|
||||
Symfony Standard Edition
|
||||
========================
|
||||
|
||||
Welcome to the Symfony Standard Edition - a fully-functional Symfony2
|
||||
application that you can use as the skeleton for your new applications.
|
||||
|
||||
This document contains information on how to download, install, and start
|
||||
using Symfony. For a more detailed explanation, see the [Installation][1]
|
||||
chapter of the Symfony Documentation.
|
||||
|
||||
1) Installing the Standard Edition
|
||||
----------------------------------
|
||||
|
||||
When it comes to installing the Symfony Standard Edition, you have the
|
||||
following options.
|
||||
|
||||
### Use Composer (*recommended*)
|
||||
|
||||
As Symfony uses [Composer][2] to manage its dependencies, the recommended way
|
||||
to create a new project is to use it.
|
||||
|
||||
If you don't have Composer yet, download it following the instructions on
|
||||
http://getcomposer.org/ or just run the following command:
|
||||
|
||||
curl -s http://getcomposer.org/installer | php
|
||||
|
||||
Then, use the `create-project` command to generate a new Symfony application:
|
||||
|
||||
composer.phar create-project symfony/framework-standard-edition path/to/install
|
||||
|
||||
Composer will install Symfony and all its dependencies under the
|
||||
`path/to/install` directory.
|
||||
|
||||
### Download an Archive File
|
||||
|
||||
To quickly test Symfony, you can also download an [archive][3] of the Standard
|
||||
Edition and unpack it somewhere under your web server root directory.
|
||||
|
||||
If you downloaded an archive "without vendors", you also need to install all
|
||||
the necessary dependencies. Download composer (see above) and run the
|
||||
following command:
|
||||
|
||||
php composer.phar install
|
||||
|
||||
2) Checking your System Configuration
|
||||
-------------------------------------
|
||||
|
||||
Before starting coding, make sure that your local system is properly
|
||||
configured for Symfony.
|
||||
|
||||
Execute the `check.php` script from the command line:
|
||||
|
||||
php app/check.php
|
||||
|
||||
Access the `config.php` script from a browser:
|
||||
|
||||
http://localhost/path/to/symfony/app/web/config.php
|
||||
|
||||
If you get any warnings or recommendations, fix them before moving on.
|
||||
|
||||
3) Browsing the Demo Application
|
||||
--------------------------------
|
||||
|
||||
Congratulations! You're now ready to use Symfony.
|
||||
|
||||
From the `config.php` page, click the "Bypass configuration and go to the
|
||||
Welcome page" link to load up your first Symfony page.
|
||||
|
||||
You can also use a web-based configurator by clicking on the "Configure your
|
||||
Symfony Application online" link of the `config.php` page.
|
||||
|
||||
To see a real-live Symfony page in action, access the following page:
|
||||
|
||||
web/app_dev.php/demo/hello/Fabien
|
||||
|
||||
3) Getting started with Symfony
|
||||
-------------------------------
|
||||
|
||||
This distribution is meant to be the starting point for your Symfony
|
||||
applications, but it also contains some sample code that you can learn from
|
||||
and play with.
|
||||
|
||||
A great way to start learning Symfony is via the [Quick Tour][4], which will
|
||||
take you through all the basic features of Symfony2.
|
||||
|
||||
Once you're feeling good, you can move onto reading the official
|
||||
[Symfony2 book][5].
|
||||
|
||||
A default bundle, `AcmeDemoBundle`, shows you Symfony2 in action. After
|
||||
playing with it, you can remove it by following these steps:
|
||||
|
||||
* delete the `src/Acme` directory;
|
||||
|
||||
* remove the routing entries referencing AcmeBundle in
|
||||
`app/config/routing_dev.yml`;
|
||||
|
||||
* remove the AcmeBundle from the registered bundles in `app/AppKernel.php`;
|
||||
|
||||
* remove the `web/bundles/acmedemo` directory;
|
||||
|
||||
* remove the inclusion of the security configuration in
|
||||
`app/config/config.yml` (remove the `- { resource: security.yml }` line)
|
||||
or tweak the security configuration to fit your needs.
|
||||
|
||||
What's inside?
|
||||
---------------
|
||||
|
||||
The Symfony Standard Edition is configured with the following defaults:
|
||||
|
||||
* Twig is the only configured template engine;
|
||||
|
||||
* Doctrine ORM/DBAL is configured;
|
||||
|
||||
* Swiftmailer is configured;
|
||||
|
||||
* Annotations for everything are enabled.
|
||||
|
||||
It comes pre-configured with the following bundles:
|
||||
|
||||
* **FrameworkBundle** - The core Symfony framework bundle
|
||||
|
||||
* [**SensioFrameworkExtraBundle**][6] - Adds several enhancements, including
|
||||
template and routing annotation capability
|
||||
|
||||
* [**DoctrineBundle**][7] - Adds support for the Doctrine ORM
|
||||
|
||||
* [**TwigBundle**][8] - Adds support for the Twig templating engine
|
||||
|
||||
* [**SecurityBundle**][9] - Adds security by integrating Symfony's security
|
||||
component
|
||||
|
||||
* [**SwiftmailerBundle**][10] - Adds support for Swiftmailer, a library for
|
||||
sending emails
|
||||
|
||||
* [**MonologBundle**][11] - Adds support for Monolog, a logging library
|
||||
|
||||
* [**AsseticBundle**][12] - Adds support for Assetic, an asset processing
|
||||
library
|
||||
|
||||
* [**JMSSecurityExtraBundle**][13] - Allows security to be added via
|
||||
annotations
|
||||
|
||||
* [**JMSDiExtraBundle**][14] - Adds more powerful dependency injection
|
||||
features
|
||||
|
||||
* **WebProfilerBundle** (in dev/test env) - Adds profiling functionality and
|
||||
the web debug toolbar
|
||||
|
||||
* **SensioDistributionBundle** (in dev/test env) - Adds functionality for
|
||||
configuring and working with Symfony distributions
|
||||
|
||||
* [**SensioGeneratorBundle**][15] (in dev/test env) - Adds code generation
|
||||
capabilities
|
||||
|
||||
* **AcmeDemoBundle** (in dev/test env) - A demo bundle with some example
|
||||
code
|
||||
|
||||
Enjoy!
|
||||
|
||||
[1]: http://symfony.com/doc/2.1/book/installation.html
|
||||
[2]: http://getcomposer.org/
|
||||
[3]: http://symfony.com/download
|
||||
[4]: http://symfony.com/doc/2.1/quick_tour/the_big_picture.html
|
||||
[5]: http://symfony.com/doc/2.1/
|
||||
[6]: http://symfony.com/doc/2.1/bundles/SensioFrameworkExtraBundle/index.html
|
||||
[7]: http://symfony.com/doc/2.1/book/doctrine.html
|
||||
[8]: http://symfony.com/doc/2.1/book/templating.html
|
||||
[9]: http://symfony.com/doc/2.1/book/security.html
|
||||
[10]: http://symfony.com/doc/2.1/cookbook/email.html
|
||||
[11]: http://symfony.com/doc/2.1/cookbook/logging/monolog.html
|
||||
[12]: http://symfony.com/doc/2.1/cookbook/assetic/asset_management.html
|
||||
[13]: http://jmsyst.com/bundles/JMSSecurityExtraBundle/1.1
|
||||
[14]: http://jmsyst.com/bundles/JMSDiExtraBundle/1.0
|
||||
[15]: http://symfony.com/doc/2.1/bundles/SensioGeneratorBundle/index.html
|
@ -0,0 +1 @@
|
||||
deny from all
|
@ -0,0 +1,9 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__.'/AppKernel.php';
|
||||
|
||||
use Symfony\Bundle\FrameworkBundle\HttpCache\HttpCache;
|
||||
|
||||
class AppCache extends HttpCache
|
||||
{
|
||||
}
|
@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
use Symfony\Component\HttpKernel\Kernel;
|
||||
use Symfony\Component\Config\Loader\LoaderInterface;
|
||||
|
||||
class AppKernel extends Kernel
|
||||
{
|
||||
public function registerBundles()
|
||||
{
|
||||
$bundles = array(
|
||||
new Symfony\Bundle\FrameworkBundle\FrameworkBundle(),
|
||||
new Symfony\Bundle\SecurityBundle\SecurityBundle(),
|
||||
new Symfony\Bundle\TwigBundle\TwigBundle(),
|
||||
new Symfony\Bundle\MonologBundle\MonologBundle(),
|
||||
new Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle(),
|
||||
new Symfony\Bundle\AsseticBundle\AsseticBundle(),
|
||||
new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(),
|
||||
new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(),
|
||||
new JMS\AopBundle\JMSAopBundle(),
|
||||
new JMS\DiExtraBundle\JMSDiExtraBundle($this),
|
||||
new JMS\SecurityExtraBundle\JMSSecurityExtraBundle(),
|
||||
);
|
||||
|
||||
if (in_array($this->getEnvironment(), array('dev', 'test'))) {
|
||||
$bundles[] = new Acme\DemoBundle\AcmeDemoBundle();
|
||||
$bundles[] = new Symfony\Bundle\WebProfilerBundle\WebProfilerBundle();
|
||||
$bundles[] = new Sensio\Bundle\DistributionBundle\SensioDistributionBundle();
|
||||
$bundles[] = new Sensio\Bundle\GeneratorBundle\SensioGeneratorBundle();
|
||||
}
|
||||
|
||||
return $bundles;
|
||||
}
|
||||
|
||||
public function registerContainerConfiguration(LoaderInterface $loader)
|
||||
{
|
||||
$loader->load(__DIR__.'/config/config_'.$this->getEnvironment().'.yml');
|
||||
}
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<title>{% block title %}Welcome!{% endblock %}</title>
|
||||
{% block stylesheets %}{% endblock %}
|
||||
<link rel="icon" type="image/x-icon" href="{{ asset('favicon.ico') }}" />
|
||||
</head>
|
||||
<body>
|
||||
{% block body %}{% endblock %}
|
||||
{% block javascripts %}{% endblock %}
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,580 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Represents a single PHP requirement, e.g. an installed extension.
|
||||
* It can be a mandatory requirement or an optional recommendation.
|
||||
* There is a special subclass, named PhpIniRequirement, to check a php.ini configuration.
|
||||
*
|
||||
* @author Tobias Schultze <http://tobion.de>
|
||||
*/
|
||||
class Requirement
|
||||
{
|
||||
private $fulfilled;
|
||||
private $testMessage;
|
||||
private $helpText;
|
||||
private $helpHtml;
|
||||
private $optional;
|
||||
|
||||
/**
|
||||
* Constructor that initializes the requirement.
|
||||
*
|
||||
* @param Boolean $fulfilled Whether the requirement is fulfilled
|
||||
* @param string $testMessage The message for testing the requirement
|
||||
* @param string $helpHtml The help text formatted in HTML for resolving the problem
|
||||
* @param string|null $helpText The help text (when null, it will be inferred from $helpHtml, i.e. stripped from HTML tags)
|
||||
* @param Boolean $optional Whether this is only an optional recommendation not a mandatory requirement
|
||||
*/
|
||||
public function __construct($fulfilled, $testMessage, $helpHtml, $helpText = null, $optional = false)
|
||||
{
|
||||
$this->fulfilled = (Boolean) $fulfilled;
|
||||
$this->testMessage = (string) $testMessage;
|
||||
$this->helpHtml = (string) $helpHtml;
|
||||
$this->helpText = null === $helpText ? strip_tags($this->helpHtml) : (string) $helpText;
|
||||
$this->optional = (Boolean) $optional;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether the requirement is fulfilled.
|
||||
*
|
||||
* @return Boolean true if fulfilled, otherwise false
|
||||
*/
|
||||
public function isFulfilled()
|
||||
{
|
||||
return $this->fulfilled;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the message for testing the requirement.
|
||||
*
|
||||
* @return string The test message
|
||||
*/
|
||||
public function getTestMessage()
|
||||
{
|
||||
return $this->testMessage;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the help text for resolving the problem
|
||||
*
|
||||
* @return string The help text
|
||||
*/
|
||||
public function getHelpText()
|
||||
{
|
||||
return $this->helpText;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the help text formatted in HTML.
|
||||
*
|
||||
* @return string The HTML help
|
||||
*/
|
||||
public function getHelpHtml()
|
||||
{
|
||||
return $this->helpHtml;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether this is only an optional recommendation and not a mandatory requirement.
|
||||
*
|
||||
* @return Boolean true if optional, false if mandatory
|
||||
*/
|
||||
public function isOptional()
|
||||
{
|
||||
return $this->optional;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents a PHP requirement in form of a php.ini configuration.
|
||||
*
|
||||
* @author Tobias Schultze <http://tobion.de>
|
||||
*/
|
||||
class PhpIniRequirement extends Requirement
|
||||
{
|
||||
/**
|
||||
* Constructor that initializes the requirement.
|
||||
*
|
||||
* @param string $cfgName The configuration name used for ini_get()
|
||||
* @param Boolean|callback $evaluation Either a Boolean indicating whether the configuration should evaluate to true or false,
|
||||
or a callback function receiving the configuration value as parameter to determine the fulfillment of the requirement
|
||||
* @param Boolean $approveCfgAbsence If true the Requirement will be fulfilled even if the configuration option does not exist, i.e. ini_get() returns false.
|
||||
This is helpful for abandoned configs in later PHP versions or configs of an optional extension, like Suhosin.
|
||||
Example: You require a config to be true but PHP later removes this config and defaults it to true internally.
|
||||
* @param string $testMessage The message for testing the requirement (when null and $evaluation is a Boolean a default message is derived)
|
||||
* @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)
|
||||
* @param string|null $helpText The help text (when null, it will be inferred from $helpHtml, i.e. stripped from HTML tags)
|
||||
* @param Boolean $optional Whether this is only an optional recommendation not a mandatory requirement
|
||||
*/
|
||||
public function __construct($cfgName, $evaluation, $approveCfgAbsence = false, $testMessage = null, $helpHtml = null, $helpText = null, $optional = false)
|
||||
{
|
||||
$cfgValue = ini_get($cfgName);
|
||||
|
||||
if (is_callable($evaluation)) {
|
||||
if (null === $testMessage || null === $helpHtml) {
|
||||
throw new InvalidArgumentException('You must provide the parameters testMessage and helpHtml for a callback evaluation.');
|
||||
}
|
||||
|
||||
$fulfilled = call_user_func($evaluation, $cfgValue);
|
||||
} else {
|
||||
if (null === $testMessage) {
|
||||
$testMessage = sprintf('%s %s be %s in php.ini',
|
||||
$cfgName,
|
||||
$optional ? 'should' : 'must',
|
||||
$evaluation ? 'enabled' : 'disabled'
|
||||
);
|
||||
}
|
||||
|
||||
if (null === $helpHtml) {
|
||||
$helpHtml = sprintf('Set <strong>%s</strong> to <strong>%s</strong> in php.ini<a href="#phpini">*</a>.',
|
||||
$cfgName,
|
||||
$evaluation ? 'on' : 'off'
|
||||
);
|
||||
}
|
||||
|
||||
$fulfilled = $evaluation == $cfgValue;
|
||||
}
|
||||
|
||||
parent::__construct($fulfilled || ($approveCfgAbsence && false === $cfgValue), $testMessage, $helpHtml, $helpText, $optional);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A RequirementCollection represents a set of Requirement instances.
|
||||
*
|
||||
* Users of PHP 5.2 should be able to run the requirements checks.
|
||||
* This is why the class must be compatible with PHP 5.2
|
||||
* (e.g. not using namespaces and closures).
|
||||
*
|
||||
* @author Tobias Schultze <http://tobion.de>
|
||||
*/
|
||||
class RequirementCollection implements IteratorAggregate
|
||||
{
|
||||
private $requirements = array();
|
||||
|
||||
/**
|
||||
* Gets the current RequirementCollection as an Iterator.
|
||||
*
|
||||
* @return Traversable A Traversable interface
|
||||
*/
|
||||
public function getIterator()
|
||||
{
|
||||
return new ArrayIterator($this->requirements);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a Requirement.
|
||||
*
|
||||
* @param Requirement $requirement A Requirement instance
|
||||
*/
|
||||
public function add(Requirement $requirement)
|
||||
{
|
||||
$this->requirements[] = $requirement;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a mandatory requirement.
|
||||
*
|
||||
* @param Boolean $fulfilled Whether the requirement is fulfilled
|
||||
* @param string $testMessage The message for testing the requirement
|
||||
* @param string $helpHtml The help text formatted in HTML for resolving the problem
|
||||
* @param string|null $helpText The help text (when null, it will be inferred from $helpHtml, i.e. stripped from HTML tags)
|
||||
*/
|
||||
public function addRequirement($fulfilled, $testMessage, $helpHtml, $helpText = null)
|
||||
{
|
||||
$this->add(new Requirement($fulfilled, $testMessage, $helpHtml, $helpText, false));
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds an optional recommendation.
|
||||
*
|
||||
* @param Boolean $fulfilled Whether the recommendation is fulfilled
|
||||
* @param string $testMessage The message for testing the recommendation
|
||||
* @param string $helpHtml The help text formatted in HTML for resolving the problem
|
||||
* @param string|null $helpText The help text (when null, it will be inferred from $helpHtml, i.e. stripped from HTML tags)
|
||||
*/
|
||||
public function addRecommendation($fulfilled, $testMessage, $helpHtml, $helpText = null)
|
||||
{
|
||||
$this->add(new Requirement($fulfilled, $testMessage, $helpHtml, $helpText, true));
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a mandatory requirement in form of a php.ini configuration.
|
||||
*
|
||||
* @param string $cfgName The configuration name used for ini_get()
|
||||
* @param Boolean|callback $evaluation Either a Boolean indicating whether the configuration should evaluate to true or false,
|
||||
or a callback function receiving the configuration value as parameter to determine the fulfillment of the requirement
|
||||
* @param Boolean $approveCfgAbsence If true the Requirement will be fulfilled even if the configuration option does not exist, i.e. ini_get() returns false.
|
||||
This is helpful for abandoned configs in later PHP versions or configs of an optional extension, like Suhosin.
|
||||
Example: You require a config to be true but PHP later removes this config and defaults it to true internally.
|
||||
* @param string $testMessage The message for testing the requirement (when null and $evaluation is a Boolean a default message is derived)
|
||||
* @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)
|
||||
* @param string|null $helpText The help text (when null, it will be inferred from $helpHtml, i.e. stripped from HTML tags)
|
||||
*/
|
||||
public function addPhpIniRequirement($cfgName, $evaluation, $approveCfgAbsence = false, $testMessage = null, $helpHtml = null, $helpText = null)
|
||||
{
|
||||
$this->add(new PhpIniRequirement($cfgName, $evaluation, $approveCfgAbsence, $testMessage, $helpHtml, $helpText, false));
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds an optional recommendation in form of a php.ini configuration.
|
||||
*
|
||||
* @param string $cfgName The configuration name used for ini_get()
|
||||
* @param Boolean|callback $evaluation Either a Boolean indicating whether the configuration should evaluate to true or false,
|
||||
or a callback function receiving the configuration value as parameter to determine the fulfillment of the requirement
|
||||
* @param Boolean $approveCfgAbsence If true the Requirement will be fulfilled even if the configuration option does not exist, i.e. ini_get() returns false.
|
||||
This is helpful for abandoned configs in later PHP versions or configs of an optional extension, like Suhosin.
|
||||
Example: You require a config to be true but PHP later removes this config and defaults it to true internally.
|
||||
* @param string $testMessage The message for testing the requirement (when null and $evaluation is a Boolean a default message is derived)
|
||||
* @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)
|
||||
* @param string|null $helpText The help text (when null, it will be inferred from $helpHtml, i.e. stripped from HTML tags)
|
||||
*/
|
||||
public function addPhpIniRecommendation($cfgName, $evaluation, $approveCfgAbsence = false, $testMessage = null, $helpHtml = null, $helpText = null)
|
||||
{
|
||||
$this->add(new PhpIniRequirement($cfgName, $evaluation, $approveCfgAbsence, $testMessage, $helpHtml, $helpText, true));
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a requirement collection to the current set of requirements.
|
||||
*
|
||||
* @param RequirementCollection $collection A RequirementCollection instance
|
||||
*/
|
||||
public function addCollection(RequirementCollection $collection)
|
||||
{
|
||||
$this->requirements = array_merge($this->requirements, $collection->all());
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns both requirements and recommendations.
|
||||
*
|
||||
* @return array Array of Requirement instances
|
||||
*/
|
||||
public function all()
|
||||
{
|
||||
return $this->requirements;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns all mandatory requirements.
|
||||
*
|
||||
* @return array Array of Requirement instances
|
||||
*/
|
||||
public function getRequirements()
|
||||
{
|
||||
$array = array();
|
||||
foreach ($this->requirements as $req) {
|
||||
if (!$req->isOptional()) {
|
||||
$array[] = $req;
|
||||
}
|
||||
}
|
||||
|
||||
return $array;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the mandatory requirements that were not met.
|
||||
*
|
||||
* @return array Array of Requirement instances
|
||||
*/
|
||||
public function getFailedRequirements()
|
||||
{
|
||||
$array = array();
|
||||
foreach ($this->requirements as $req) {
|
||||
if (!$req->isFulfilled() && !$req->isOptional()) {
|
||||
$array[] = $req;
|
||||
}
|
||||
}
|
||||
|
||||
return $array;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns all optional recommmendations.
|
||||
*
|
||||
* @return array Array of Requirement instances
|
||||
*/
|
||||
public function getRecommendations()
|
||||
{
|
||||
$array = array();
|
||||
foreach ($this->requirements as $req) {
|
||||
if ($req->isOptional()) {
|
||||
$array[] = $req;
|
||||
}
|
||||
}
|
||||
|
||||
return $array;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the recommendations that were not met.
|
||||
*
|
||||
* @return array Array of Requirement instances
|
||||
*/
|
||||
public function getFailedRecommendations()
|
||||
{
|
||||
$array = array();
|
||||
foreach ($this->requirements as $req) {
|
||||
if (!$req->isFulfilled() && $req->isOptional()) {
|
||||
$array[] = $req;
|
||||
}
|
||||
}
|
||||
|
||||
return $array;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether a php.ini configuration is not correct.
|
||||
*
|
||||
* @return Boolean php.ini configuration problem?
|
||||
*/
|
||||
public function hasPhpIniConfigIssue()
|
||||
{
|
||||
foreach ($this->requirements as $req) {
|
||||
if (!$req->isFulfilled() && $req instanceof PhpIniRequirement) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the PHP configuration file (php.ini) path.
|
||||
*
|
||||
* @return string|false php.ini file path
|
||||
*/
|
||||
public function getPhpIniConfigPath()
|
||||
{
|
||||
return get_cfg_var('cfg_file_path');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This class specifies all requirements and optional recommendations that
|
||||
* are necessary to run the Symfony Standard Edition.
|
||||
*
|
||||
* @author Tobias Schultze <http://tobion.de>
|
||||
*/
|
||||
class SymfonyRequirements extends RequirementCollection
|
||||
{
|
||||
const REQUIRED_PHP_VERSION = '5.3.3';
|
||||
|
||||
/**
|
||||
* Constructor that initializes the requirements.
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
/* mandatory requirements follow */
|
||||
|
||||
$installedPhpVersion = phpversion();
|
||||
|
||||
$this->addRequirement(
|
||||
version_compare($installedPhpVersion, self::REQUIRED_PHP_VERSION, '>='),
|
||||
sprintf('PHP version must be at least %s (%s installed)', self::REQUIRED_PHP_VERSION, $installedPhpVersion),
|
||||
sprintf('You are running PHP version "<strong>%s</strong>", but Symfony needs at least PHP "<strong>%s</strong>" to run.
|
||||
Before using Symfony, upgrade your PHP installation, preferably to the latest version.',
|
||||
$installedPhpVersion, self::REQUIRED_PHP_VERSION),
|
||||
sprintf('Install PHP %s or newer (installed version is %s)', self::REQUIRED_PHP_VERSION, $installedPhpVersion)
|
||||
);
|
||||
|
||||
$this->addRequirement(
|
||||
is_dir(__DIR__.'/../vendor/symfony'),
|
||||
'Vendor libraries must be installed',
|
||||
'Vendor libraries are missing. Install composer following instructions from <a href="http://getcomposer.org/">http://getcomposer.org/</a>. ' .
|
||||
'Then run "<strong>php composer.phar install</strong>" to install them.'
|
||||
);
|
||||
|
||||
$baseDir = basename(__DIR__);
|
||||
$this->addRequirement(
|
||||
is_writable(__DIR__.'/cache'),
|
||||
"$baseDir/cache/ directory must be writable",
|
||||
"Change the permissions of the \"<strong>$baseDir/cache/</strong>\" directory so that the web server can write into it."
|
||||
);
|
||||
|
||||
$this->addRequirement(
|
||||
is_writable(__DIR__.'/logs'),
|
||||
"$baseDir/logs/ directory must be writable",
|
||||
"Change the permissions of the \"<strong>$baseDir/logs/</strong>\" directory so that the web server can write into it."
|
||||
);
|
||||
|
||||
$this->addPhpIniRequirement(
|
||||
'date.timezone', true, false,
|
||||
'date.timezone setting must be set',
|
||||
'Set the "<strong>date.timezone</strong>" setting in php.ini<a href="#phpini">*</a> (like Europe/Paris).'
|
||||
);
|
||||
|
||||
if (version_compare($installedPhpVersion, self::REQUIRED_PHP_VERSION, '>=')) {
|
||||
$this->addRequirement(
|
||||
(in_array(date_default_timezone_get(), \DateTimeZone::listIdentifiers())),
|
||||
sprintf('Default timezone is deprecated (%s)', date_default_timezone_get()),
|
||||
'Fix your <strong>php.ini</strong> file (list of deprecated timezones http://us.php.net/manual/en/timezones.others.php).'
|
||||
);
|
||||
}
|
||||
|
||||
$this->addRequirement(
|
||||
function_exists('json_encode'),
|
||||
'json_encode() must be available',
|
||||
'Install and enable the <strong>JSON</strong> extension.'
|
||||
);
|
||||
|
||||
$this->addRequirement(
|
||||
function_exists('session_start'),
|
||||
'session_start() must be available',
|
||||
'Install and enable the <strong>session</strong> extension.'
|
||||
);
|
||||
|
||||
$this->addRequirement(
|
||||
function_exists('ctype_alpha'),
|
||||
'ctype_alpha() must be available',
|
||||
'Install and enable the <strong>ctype</strong> extension.'
|
||||
);
|
||||
|
||||
$this->addRequirement(
|
||||
function_exists('token_get_all'),
|
||||
'token_get_all() must be available',
|
||||
'Install and enable the <strong>Tokenizer</strong> extension.'
|
||||
);
|
||||
|
||||
$this->addRequirement(
|
||||
function_exists('simplexml_import_dom'),
|
||||
'simplexml_import_dom() must be available',
|
||||
'Install and enable the <strong>SimpleXML</strong> extension.'
|
||||
);
|
||||
|
||||
$this->addRequirement(
|
||||
!(function_exists('apc_store') && ini_get('apc.enabled')) || version_compare(phpversion('apc'), '3.0.17', '>='),
|
||||
'APC version must be at least 3.0.17',
|
||||
'Upgrade your <strong>APC</strong> extension (3.0.17+)'
|
||||
);
|
||||
|
||||
$this->addPhpIniRequirement('detect_unicode', false);
|
||||
|
||||
$this->addPhpIniRequirement(
|
||||
'suhosin.executor.include.whitelist',
|
||||
create_function('$cfgValue', 'return false !== stripos($cfgValue, "phar");'),
|
||||
true,
|
||||
'suhosin.executor.include.whitelist must be configured correctly in php.ini',
|
||||
'Add "<strong>phar</strong>" to <strong>suhosin.executor.include.whitelist</strong> in php.ini<a href="#phpini">*</a>.'
|
||||
);
|
||||
|
||||
$pcreVersion = defined('PCRE_VERSION') ? (float) PCRE_VERSION : null;
|
||||
|
||||
$this->addRequirement(
|
||||
null !== $pcreVersion && $pcreVersion > 8.0,
|
||||
sprintf('PCRE extension must be available and at least 8.0 (%s installed)', $pcreVersion ? $pcreVersion : 'not'),
|
||||
'Upgrade your <strong>PCRE</strong> extension (8.0+)'
|
||||
);
|
||||
|
||||
/* optional recommendations follow */
|
||||
|
||||
$this->addRecommendation(
|
||||
version_compare($installedPhpVersion, '5.3.8', '>='),
|
||||
sprintf('Annotations might not work properly due to the PHP bug #55156 before PHP 5.3.8 (%s installed)', $installedPhpVersion),
|
||||
'Install PHP 5.3.8 or newer if your project uses annotations'
|
||||
);
|
||||
|
||||
$this->addRecommendation(
|
||||
class_exists('DomDocument'),
|
||||
'PHP-XML module should be installed',
|
||||
'Install and enable the <strong>PHP-XML</strong> module.'
|
||||
);
|
||||
|
||||
$this->addRecommendation(
|
||||
function_exists('mb_strlen'),
|
||||
'mb_strlen() should be available',
|
||||
'Install and enable the <strong>mbstring</strong> extension.'
|
||||
);
|
||||
|
||||
$this->addRecommendation(
|
||||
function_exists('iconv'),
|
||||
'iconv() should be available',
|
||||
'Install and enable the <strong>iconv</strong> extension.'
|
||||
);
|
||||
|
||||
$this->addRecommendation(
|
||||
function_exists('utf8_decode'),
|
||||
'utf8_decode() should be available',
|
||||
'Install and enable the <strong>XML</strong> extension.'
|
||||
);
|
||||
|
||||
if (!defined('PHP_WINDOWS_VERSION_BUILD')) {
|
||||
$this->addRecommendation(
|
||||
function_exists('posix_isatty'),
|
||||
'posix_isatty() should be available',
|
||||
'Install and enable the <strong>php_posix</strong> extension (used to colorize the CLI output).'
|
||||
);
|
||||
}
|
||||
|
||||
$this->addRecommendation(
|
||||
class_exists('Locale'),
|
||||
'intl extension should be available',
|
||||
'Install and enable the <strong>intl</strong> extension (used for validators).'
|
||||
);
|
||||
|
||||
if (class_exists('Locale')) {
|
||||
if (defined('INTL_ICU_VERSION')) {
|
||||
$version = INTL_ICU_VERSION;
|
||||
} else {
|
||||
$reflector = new ReflectionExtension('intl');
|
||||
|
||||
ob_start();
|
||||
$reflector->info();
|
||||
$output = strip_tags(ob_get_clean());
|
||||
|
||||
preg_match('/^ICU version +(?:=> )?(.*)$/m', $output, $matches);
|
||||
$version = $matches[1];
|
||||
}
|
||||
|
||||
$this->addRecommendation(
|
||||
version_compare($version, '4.0', '>='),
|
||||
'intl ICU version should be at least 4+',
|
||||
'Upgrade your <strong>intl</strong> extension with a newer ICU version (4+).'
|
||||
);
|
||||
}
|
||||
|
||||
$accelerator =
|
||||
(function_exists('apc_store') && ini_get('apc.enabled'))
|
||||
||
|
||||
function_exists('eaccelerator_put') && ini_get('eaccelerator.enable')
|
||||
||
|
||||
function_exists('xcache_set')
|
||||
;
|
||||
|
||||
$this->addRecommendation(
|
||||
$accelerator,
|
||||
'a PHP accelerator should be installed',
|
||||
'Install and enable a <strong>PHP accelerator</strong> like APC (highly recommended).'
|
||||
);
|
||||
|
||||
$this->addPhpIniRecommendation('short_open_tag', false);
|
||||
|
||||
$this->addPhpIniRecommendation('magic_quotes_gpc', false, true);
|
||||
|
||||
$this->addPhpIniRecommendation('register_globals', false, true);
|
||||
|
||||
$this->addPhpIniRecommendation('session.auto_start', false);
|
||||
|
||||
$this->addRecommendation(
|
||||
class_exists('PDO'),
|
||||
'PDO should be installed',
|
||||
'Install <strong>PDO</strong> (mandatory for Doctrine).'
|
||||
);
|
||||
|
||||
if (class_exists('PDO')) {
|
||||
$drivers = PDO::getAvailableDrivers();
|
||||
$this->addRecommendation(
|
||||
count($drivers),
|
||||
sprintf('PDO should have some drivers installed (currently available: %s)', count($drivers) ? implode(', ', $drivers) : 'none'),
|
||||
'Install <strong>PDO drivers</strong> (mandatory for Doctrine).'
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
use Doctrine\Common\Annotations\AnnotationRegistry;
|
||||
|
||||
if (!$loader = @include __DIR__.'/../vendor/autoload.php') {
|
||||
|
||||
$message = <<< EOF
|
||||
<p>You must set up the project dependencies by running the following commands:</p>
|
||||
<pre>
|
||||
curl -s http://getcomposer.org/installer | php
|
||||
php composer.phar install
|
||||
</pre>
|
||||
|
||||
EOF;
|
||||
|
||||
if (PHP_SAPI === 'cli') {
|
||||
$message = strip_tags($message);
|
||||
}
|
||||
|
||||
die($message);
|
||||
}
|
||||
|
||||
// intl
|
||||
if (!function_exists('intl_get_error_code')) {
|
||||
require_once __DIR__.'/../vendor/symfony/symfony/src/Symfony/Component/Locale/Resources/stubs/functions.php';
|
||||
|
||||
$loader->add('', __DIR__.'/../vendor/symfony/symfony/src/Symfony/Component/Locale/Resources/stubs');
|
||||
}
|
||||
|
||||
AnnotationRegistry::registerLoader(array($loader, 'loadClass'));
|
||||
|
||||
return $loader;
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,55 @@
|
||||
<?php
|
||||
|
||||
require_once dirname(__FILE__).'/SymfonyRequirements.php';
|
||||
|
||||
$symfonyRequirements = new SymfonyRequirements();
|
||||
|
||||
$iniPath = $symfonyRequirements->getPhpIniConfigPath();
|
||||
|
||||
echo "********************************\n";
|
||||
echo "* *\n";
|
||||
echo "* Symfony requirements check *\n";
|
||||
echo "* *\n";
|
||||
echo "********************************\n\n";
|
||||
|
||||
echo $iniPath ? sprintf("* Configuration file used by PHP: %s\n\n", $iniPath) : "* WARNING: No configuration file (php.ini) used by PHP!\n\n";
|
||||
|
||||
echo "** ATTENTION **\n";
|
||||
echo "* The PHP CLI can use a different php.ini file\n";
|
||||
echo "* than the one used with your web server.\n";
|
||||
if ('\\' == DIRECTORY_SEPARATOR) {
|
||||
echo "* (especially on the Windows platform)\n";
|
||||
}
|
||||
echo "* To be on the safe side, please also launch the requirements check\n";
|
||||
echo "* from your web server using the web/config.php script.\n";
|
||||
|
||||
echo_title('Mandatory requirements');
|
||||
|
||||
foreach ($symfonyRequirements->getRequirements() as $req) {
|
||||
echo_requirement($req);
|
||||
}
|
||||
|
||||
echo_title('Optional recommendations');
|
||||
|
||||
foreach ($symfonyRequirements->getRecommendations() as $req) {
|
||||
echo_requirement($req);
|
||||
}
|
||||
|
||||
/**
|
||||
* Prints a Requirement instance
|
||||
*/
|
||||
function echo_requirement(Requirement $requirement)
|
||||
{
|
||||
$result = $requirement->isFulfilled() ? 'OK' : ($requirement->isOptional() ? 'WARNING' : 'ERROR');
|
||||
echo ' ' . str_pad($result, 9);
|
||||
echo $requirement->getTestMessage() . "\n";
|
||||
|
||||
if (!$requirement->isFulfilled()) {
|
||||
echo sprintf(" %s\n\n", $requirement->getHelpText());
|
||||
}
|
||||
}
|
||||
|
||||
function echo_title($title)
|
||||
{
|
||||
echo "\n** $title **\n\n";
|
||||
}
|
@ -0,0 +1,60 @@
|
||||
imports:
|
||||
- { resource: parameters.yml }
|
||||
- { resource: security.yml }
|
||||
|
||||
framework:
|
||||
#esi: ~
|
||||
#translator: { fallback: %locale% }
|
||||
secret: %secret%
|
||||
charset: UTF-8
|
||||
router:
|
||||
resource: "%kernel.root_dir%/config/routing.yml"
|
||||
strict_parameters: %kernel.debug%
|
||||
form: true
|
||||
csrf_protection: true
|
||||
validation: { enable_annotations: true }
|
||||
templating: { engines: ['twig'] } #assets_version: SomeVersionScheme
|
||||
default_locale: %locale%
|
||||
session:
|
||||
auto_start: true
|
||||
|
||||
# Twig Configuration
|
||||
twig:
|
||||
debug: %kernel.debug%
|
||||
strict_variables: %kernel.debug%
|
||||
|
||||
# Assetic Configuration
|
||||
assetic:
|
||||
debug: %kernel.debug%
|
||||
use_controller: false
|
||||
bundles: [ ]
|
||||
#java: /usr/bin/java
|
||||
filters:
|
||||
cssrewrite: ~
|
||||
#closure:
|
||||
# jar: %kernel.root_dir%/Resources/java/compiler.jar
|
||||
#yui_css:
|
||||
# jar: %kernel.root_dir%/Resources/java/yuicompressor-2.4.7.jar
|
||||
|
||||
# Doctrine Configuration
|
||||
doctrine:
|
||||
dbal:
|
||||
driver: %database_driver%
|
||||
host: %database_host%
|
||||
port: %database_port%
|
||||
dbname: %database_name%
|
||||
user: %database_user%
|
||||
password: %database_password%
|
||||
charset: UTF8
|
||||
|
||||
orm:
|
||||
auto_generate_proxy_classes: %kernel.debug%
|
||||
auto_mapping: true
|
||||
|
||||
# Swiftmailer Configuration
|
||||
swiftmailer:
|
||||
transport: %mailer_transport%
|
||||
host: %mailer_host%
|
||||
username: %mailer_user%
|
||||
password: %mailer_password%
|
||||
spool: { type: memory }
|
@ -0,0 +1,26 @@
|
||||
imports:
|
||||
- { resource: config.yml }
|
||||
|
||||
framework:
|
||||
router: { resource: "%kernel.root_dir%/config/routing_dev.yml" }
|
||||
profiler: { only_exceptions: false }
|
||||
|
||||
web_profiler:
|
||||
toolbar: true
|
||||
intercept_redirects: false
|
||||
|
||||
monolog:
|
||||
handlers:
|
||||
main:
|
||||
type: stream
|
||||
path: %kernel.logs_dir%/%kernel.environment%.log
|
||||
level: debug
|
||||
firephp:
|
||||
type: firephp
|
||||
level: info
|
||||
|
||||
assetic:
|
||||
use_controller: true
|
||||
|
||||
#swiftmailer:
|
||||
# delivery_address: me@example.com
|
@ -0,0 +1,19 @@
|
||||
imports:
|
||||
- { resource: config.yml }
|
||||
|
||||
#doctrine:
|
||||
# orm:
|
||||
# metadata_cache_driver: apc
|
||||
# result_cache_driver: apc
|
||||
# query_cache_driver: apc
|
||||
|
||||
monolog:
|
||||
handlers:
|
||||
main:
|
||||
type: fingers_crossed
|
||||
action_level: error
|
||||
handler: nested
|
||||
nested:
|
||||
type: stream
|
||||
path: %kernel.logs_dir%/%kernel.environment%.log
|
||||
level: debug
|
@ -0,0 +1,14 @@
|
||||
imports:
|
||||
- { resource: config_dev.yml }
|
||||
|
||||
framework:
|
||||
test: ~
|
||||
session:
|
||||
storage_id: session.storage.mock_file
|
||||
|
||||
web_profiler:
|
||||
toolbar: false
|
||||
intercept_redirects: false
|
||||
|
||||
swiftmailer:
|
||||
disable_delivery: true
|
@ -0,0 +1,15 @@
|
||||
parameters:
|
||||
database_driver: pdo_mysql
|
||||
database_host: localhost
|
||||
database_port: ~
|
||||
database_name: symfony
|
||||
database_user: root
|
||||
database_password: ~
|
||||
|
||||
mailer_transport: smtp
|
||||
mailer_host: localhost
|
||||
mailer_user: ~
|
||||
mailer_password: ~
|
||||
|
||||
locale: en
|
||||
secret: ThisTokenIsNotSoSecretChangeIt
|
@ -0,0 +1,4 @@
|
||||
# Internal routing configuration to handle ESI
|
||||
#_internal:
|
||||
# resource: "@FrameworkBundle/Resources/config/routing/internal.xml"
|
||||
# prefix: /_internal
|
@ -0,0 +1,27 @@
|
||||
_welcome:
|
||||
pattern: /
|
||||
defaults: { _controller: AcmeDemoBundle:Welcome:index }
|
||||
|
||||
_demo_secured:
|
||||
resource: "@AcmeDemoBundle/Controller/SecuredController.php"
|
||||
type: annotation
|
||||
|
||||
_demo:
|
||||
resource: "@AcmeDemoBundle/Controller/DemoController.php"
|
||||
type: annotation
|
||||
prefix: /demo
|
||||
|
||||
_wdt:
|
||||
resource: "@WebProfilerBundle/Resources/config/routing/wdt.xml"
|
||||
prefix: /_wdt
|
||||
|
||||
_profiler:
|
||||
resource: "@WebProfilerBundle/Resources/config/routing/profiler.xml"
|
||||
prefix: /_profiler
|
||||
|
||||
_configurator:
|
||||
resource: "@SensioDistributionBundle/Resources/config/routing/webconfigurator.xml"
|
||||
prefix: /_configurator
|
||||
|
||||
_main:
|
||||
resource: routing.yml
|
@ -0,0 +1,43 @@
|
||||
jms_security_extra:
|
||||
secure_all_services: false
|
||||
expressions: true
|
||||
|
||||
security:
|
||||
encoders:
|
||||
Symfony\Component\Security\Core\User\User: plaintext
|
||||
|
||||
role_hierarchy:
|
||||
ROLE_ADMIN: ROLE_USER
|
||||
ROLE_SUPER_ADMIN: [ROLE_USER, ROLE_ADMIN, ROLE_ALLOWED_TO_SWITCH]
|
||||
|
||||
providers:
|
||||
in_memory:
|
||||
memory:
|
||||
users:
|
||||
user: { password: userpass, roles: [ 'ROLE_USER' ] }
|
||||
admin: { password: adminpass, roles: [ 'ROLE_ADMIN' ] }
|
||||
|
||||
firewalls:
|
||||
dev:
|
||||
pattern: ^/(_(profiler|wdt)|css|images|js)/
|
||||
security: false
|
||||
|
||||
login:
|
||||
pattern: ^/demo/secured/login$
|
||||
security: false
|
||||
|
||||
secured_area:
|
||||
pattern: ^/demo/secured/
|
||||
form_login:
|
||||
check_path: /demo/secured/login_check
|
||||
login_path: /demo/secured/login
|
||||
logout:
|
||||
path: /demo/secured/logout
|
||||
target: /demo/
|
||||
#anonymous: ~
|
||||
#http_basic:
|
||||
# realm: "Secured Demo Area"
|
||||
|
||||
access_control:
|
||||
#- { path: ^/login, roles: IS_AUTHENTICATED_ANONYMOUSLY, requires_channel: https }
|
||||
#- { path: ^/_internal/secure, roles: IS_AUTHENTICATED_ANONYMOUSLY, ip: 127.0.0.1 }
|
@ -0,0 +1,22 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
|
||||
// if you don't want to setup permissions the proper way, just uncomment the following PHP line
|
||||
// read http://symfony.com/doc/current/book/installation.html#configuration-and-setup for more information
|
||||
//umask(0000);
|
||||
|
||||
set_time_limit(0);
|
||||
|
||||
require_once __DIR__.'/bootstrap.php.cache';
|
||||
require_once __DIR__.'/AppKernel.php';
|
||||
|
||||
use Symfony\Bundle\FrameworkBundle\Console\Application;
|
||||
use Symfony\Component\Console\Input\ArgvInput;
|
||||
|
||||
$input = new ArgvInput();
|
||||
$env = $input->getParameterOption(array('--env', '-e'), getenv('SYMFONY_ENV') ?: 'dev');
|
||||
$debug = getenv('SYMFONY_DEBUG') !== '0' && !$input->hasParameterOption(array('--no-debug', '')) && $env !== 'prod';
|
||||
|
||||
$kernel = new AppKernel($env, $debug);
|
||||
$application = new Application($kernel);
|
||||
$application->run($input);
|
@ -0,0 +1,41 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<!-- http://www.phpunit.de/manual/current/en/appendixes.configuration.html -->
|
||||
<phpunit
|
||||
backupGlobals = "false"
|
||||
backupStaticAttributes = "false"
|
||||
colors = "true"
|
||||
convertErrorsToExceptions = "true"
|
||||
convertNoticesToExceptions = "true"
|
||||
convertWarningsToExceptions = "true"
|
||||
processIsolation = "false"
|
||||
stopOnFailure = "false"
|
||||
syntaxCheck = "false"
|
||||
bootstrap = "bootstrap.php.cache" >
|
||||
|
||||
<testsuites>
|
||||
<testsuite name="Project Test Suite">
|
||||
<directory>../src/*/*Bundle/Tests</directory>
|
||||
<directory>../src/*/Bundle/*Bundle/Tests</directory>
|
||||
</testsuite>
|
||||
</testsuites>
|
||||
|
||||
<!--
|
||||
<php>
|
||||
<server name="KERNEL_DIR" value="/path/to/your/app/" />
|
||||
</php>
|
||||
-->
|
||||
|
||||
<filter>
|
||||
<whitelist>
|
||||
<directory>../src</directory>
|
||||
<exclude>
|
||||
<directory>../src/*/*Bundle/Resources</directory>
|
||||
<directory>../src/*/*Bundle/Tests</directory>
|
||||
<directory>../src/*/Bundle/*Bundle/Resources</directory>
|
||||
<directory>../src/*/Bundle/*Bundle/Tests</directory>
|
||||
</exclude>
|
||||
</whitelist>
|
||||
</filter>
|
||||
|
||||
</phpunit>
|
@ -0,0 +1,41 @@
|
||||
{
|
||||
"name": "symfony/framework-standard-edition",
|
||||
"description": "The \"Symfony Standard Edition\" distribution",
|
||||
"autoload": {
|
||||
"psr-0": { "": "src/" }
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.3.3",
|
||||
"symfony/symfony": "2.1.*",
|
||||
"doctrine/orm": "2.2.*",
|
||||
"doctrine/doctrine-bundle": "dev-master",
|
||||
"twig/extensions": "dev-master",
|
||||
"symfony/assetic-bundle": "dev-master",
|
||||
"symfony/swiftmailer-bundle": "dev-master",
|
||||
"symfony/monolog-bundle": "dev-master",
|
||||
"sensio/distribution-bundle": "dev-master",
|
||||
"sensio/framework-extra-bundle": "dev-master",
|
||||
"sensio/generator-bundle": "dev-master",
|
||||
"jms/security-extra-bundle": "1.1.*",
|
||||
"jms/di-extra-bundle": "1.0.*"
|
||||
},
|
||||
"scripts": {
|
||||
"post-install-cmd": [
|
||||
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
|
||||
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
|
||||
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets"
|
||||
],
|
||||
"post-update-cmd": [
|
||||
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
|
||||
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
|
||||
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets"
|
||||
]
|
||||
},
|
||||
"config": {
|
||||
"bin-dir": "bin"
|
||||
},
|
||||
"extra": {
|
||||
"symfony-app-dir": "app",
|
||||
"symfony-web-dir": "web"
|
||||
}
|
||||
}
|
@ -0,0 +1,144 @@
|
||||
{
|
||||
"hash": "60f09c83d9f0891b51ac51941970dcd5",
|
||||
"packages": [
|
||||
{
|
||||
"package": "doctrine/common",
|
||||
"version": "2.2.2"
|
||||
},
|
||||
{
|
||||
"package": "doctrine/dbal",
|
||||
"version": "2.2.x-dev",
|
||||
"source-reference": "8cc129aa64a8de6447056bce20f0a274fe2a340b"
|
||||
},
|
||||
{
|
||||
"package": "doctrine/doctrine-bundle",
|
||||
"version": "dev-master",
|
||||
"source-reference": "94951737d6c692500d6b13bb92871935568a4ba5"
|
||||
},
|
||||
{
|
||||
"package": "doctrine/orm",
|
||||
"version": "2.2.x-dev",
|
||||
"source-reference": "5f66c65c9a8d984899903b54215d0249a45b92d6"
|
||||
},
|
||||
{
|
||||
"package": "jms/aop-bundle",
|
||||
"version": "1.0.0"
|
||||
},
|
||||
{
|
||||
"package": "jms/cg",
|
||||
"version": "1.0.0"
|
||||
},
|
||||
{
|
||||
"package": "jms/di-extra-bundle",
|
||||
"version": "1.0.1"
|
||||
},
|
||||
{
|
||||
"package": "jms/metadata",
|
||||
"version": "1.1.1"
|
||||
},
|
||||
{
|
||||
"package": "jms/security-extra-bundle",
|
||||
"version": "1.1.0"
|
||||
},
|
||||
{
|
||||
"package": "kriswallsmith/assetic",
|
||||
"version": "dev-master",
|
||||
"alias-pretty-version": "1.1.x-dev",
|
||||
"alias-version": "1.1.9999999.9999999-dev"
|
||||
},
|
||||
{
|
||||
"package": "kriswallsmith/assetic",
|
||||
"version": "dev-master",
|
||||
"source-reference": "d6f89a3170c5280ad554347dc113eb25fdf00ad7"
|
||||
},
|
||||
{
|
||||
"package": "monolog/monolog",
|
||||
"version": "1.1.0"
|
||||
},
|
||||
{
|
||||
"package": "sensio/distribution-bundle",
|
||||
"version": "dev-master",
|
||||
"source-reference": "a360ad61fe34206a7295c1ef00b5455b2b2e1071"
|
||||
},
|
||||
{
|
||||
"package": "sensio/framework-extra-bundle",
|
||||
"version": "dev-master",
|
||||
"source-reference": "62e41b85947034b0f1dfe31bb8e76920e1488571"
|
||||
},
|
||||
{
|
||||
"package": "sensio/generator-bundle",
|
||||
"version": "dev-master",
|
||||
"source-reference": "43ed45c48db18e4a0e48aec0c098f42e56e22d36"
|
||||
},
|
||||
{
|
||||
"package": "swiftmailer/swiftmailer",
|
||||
"version": "dev-master",
|
||||
"alias-pretty-version": "4.1.x-dev",
|
||||
"alias-version": "4.1.9999999.9999999-dev"
|
||||
},
|
||||
{
|
||||
"package": "swiftmailer/swiftmailer",
|
||||
"version": "dev-master",
|
||||
"source-reference": "d57ffdeed664d6061cef0047e1f5d3fc3ee3fb99"
|
||||
},
|
||||
{
|
||||
"package": "symfony/assetic-bundle",
|
||||
"version": "dev-master",
|
||||
"source-reference": "8fe7b898b08103c1d6fce64c3e279a7afd61adfc"
|
||||
},
|
||||
{
|
||||
"package": "symfony/monolog-bundle",
|
||||
"version": "dev-master",
|
||||
"source-reference": "0b5046d3d1ef93cd59ceabfa37de2665f5118c7f"
|
||||
},
|
||||
{
|
||||
"package": "symfony/swiftmailer-bundle",
|
||||
"version": "dev-master",
|
||||
"source-reference": "d05c9c514a631ee688c53c4cc5505da757bd50d3"
|
||||
},
|
||||
{
|
||||
"package": "symfony/symfony",
|
||||
"version": "dev-master",
|
||||
"alias-pretty-version": "2.1.x-dev",
|
||||
"alias-version": "2.1.9999999.9999999-dev"
|
||||
},
|
||||
{
|
||||
"package": "symfony/symfony",
|
||||
"version": "dev-master",
|
||||
"source-reference": "v2.1.0-BETA1"
|
||||
},
|
||||
{
|
||||
"package": "twig/extensions",
|
||||
"version": "dev-master",
|
||||
"source-reference": "feb6d3f10c411e2631997c0a905aa581c80305c1"
|
||||
},
|
||||
{
|
||||
"package": "twig/twig",
|
||||
"version": "dev-master",
|
||||
"alias-pretty-version": "1.8.x-dev",
|
||||
"alias-version": "1.8.9999999.9999999-dev"
|
||||
},
|
||||
{
|
||||
"package": "twig/twig",
|
||||
"version": "dev-master",
|
||||
"source-reference": "4679ad51c5390648b7ea4c8f0ecd2c0c344145ba"
|
||||
}
|
||||
],
|
||||
"packages-dev": [
|
||||
|
||||
],
|
||||
"aliases": [
|
||||
|
||||
],
|
||||
"minimum-stability": "dev",
|
||||
"stability-flags": {
|
||||
"doctrine/doctrine-bundle": 20,
|
||||
"twig/extensions": 20,
|
||||
"symfony/assetic-bundle": 20,
|
||||
"symfony/swiftmailer-bundle": 20,
|
||||
"symfony/monolog-bundle": 20,
|
||||
"sensio/distribution-bundle": 20,
|
||||
"sensio/framework-extra-bundle": 20,
|
||||
"sensio/generator-bundle": 20
|
||||
}
|
||||
}
|
@ -0,0 +1 @@
|
||||
deny from all
|
@ -0,0 +1,9 @@
|
||||
<?php
|
||||
|
||||
namespace Acme\DemoBundle;
|
||||
|
||||
use Symfony\Component\HttpKernel\Bundle\Bundle;
|
||||
|
||||
class AcmeDemoBundle extends Bundle
|
||||
{
|
||||
}
|
@ -0,0 +1,57 @@
|
||||
<?php
|
||||
|
||||
namespace Acme\DemoBundle\Controller;
|
||||
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
|
||||
use Symfony\Component\HttpFoundation\RedirectResponse;
|
||||
use Acme\DemoBundle\Form\ContactType;
|
||||
|
||||
// these import the "@Route" and "@Template" annotations
|
||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
|
||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
|
||||
|
||||
class DemoController extends Controller
|
||||
{
|
||||
/**
|
||||
* @Route("/", name="_demo")
|
||||
* @Template()
|
||||
*/
|
||||
public function indexAction()
|
||||
{
|
||||
return array();
|
||||
}
|
||||
|
||||
/**
|
||||
* @Route("/hello/{name}", name="_demo_hello")
|
||||
* @Template()
|
||||
*/
|
||||
public function helloAction($name)
|
||||
{
|
||||
return array('name' => $name);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Route("/contact", name="_demo_contact")
|
||||
* @Template()
|
||||
*/
|
||||
public function contactAction()
|
||||
{
|
||||
$form = $this->get('form.factory')->create(new ContactType());
|
||||
|
||||
$request = $this->get('request');
|
||||
if ('POST' == $request->getMethod()) {
|
||||
$form->bindRequest($request);
|
||||
if ($form->isValid()) {
|
||||
$mailer = $this->get('mailer');
|
||||
// .. setup a message and send it
|
||||
// http://symfony.com/doc/current/cookbook/email.html
|
||||
|
||||
$this->get('session')->setFlash('notice', 'Message sent!');
|
||||
|
||||
return new RedirectResponse($this->generateUrl('_demo'));
|
||||
}
|
||||
}
|
||||
|
||||
return array('form' => $form->createView());
|
||||
}
|
||||
}
|
@ -0,0 +1,69 @@
|
||||
<?php
|
||||
|
||||
namespace Acme\DemoBundle\Controller;
|
||||
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
|
||||
use Symfony\Component\Security\Core\SecurityContext;
|
||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
|
||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
|
||||
use JMS\SecurityExtraBundle\Annotation\Secure;
|
||||
|
||||
/**
|
||||
* @Route("/demo/secured")
|
||||
*/
|
||||
class SecuredController extends Controller
|
||||
{
|
||||
/**
|
||||
* @Route("/login", name="_demo_login")
|
||||
* @Template()
|
||||
*/
|
||||
public function loginAction()
|
||||
{
|
||||
if ($this->get('request')->attributes->has(SecurityContext::AUTHENTICATION_ERROR)) {
|
||||
$error = $this->get('request')->attributes->get(SecurityContext::AUTHENTICATION_ERROR);
|
||||
} else {
|
||||
$error = $this->get('request')->getSession()->get(SecurityContext::AUTHENTICATION_ERROR);
|
||||
}
|
||||
|
||||
return array(
|
||||
'last_username' => $this->get('request')->getSession()->get(SecurityContext::LAST_USERNAME),
|
||||
'error' => $error,
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Route("/login_check", name="_security_check")
|
||||
*/
|
||||
public function securityCheckAction()
|
||||
{
|
||||
// The security layer will intercept this request
|
||||
}
|
||||
|
||||
/**
|
||||
* @Route("/logout", name="_demo_logout")
|
||||
*/
|
||||
public function logoutAction()
|
||||
{
|
||||
// The security layer will intercept this request
|
||||
}
|
||||
|
||||
/**
|
||||
* @Route("/hello", defaults={"name"="World"}),
|
||||
* @Route("/hello/{name}", name="_demo_secured_hello")
|
||||
* @Template()
|
||||
*/
|
||||
public function helloAction($name)
|
||||
{
|
||||
return array('name' => $name);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Route("/hello/admin/{name}", name="_demo_secured_hello_admin")
|
||||
* @Secure(roles="ROLE_ADMIN")
|
||||
* @Template()
|
||||
*/
|
||||
public function helloadminAction($name)
|
||||
{
|
||||
return array('name' => $name);
|
||||
}
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace Acme\DemoBundle\Controller;
|
||||
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
|
||||
|
||||
class WelcomeController extends Controller
|
||||
{
|
||||
public function indexAction()
|
||||
{
|
||||
/*
|
||||
* The action's view can be rendered using render() method
|
||||
* or @Template annotation as demonstrated in DemoController.
|
||||
*
|
||||
*/
|
||||
return $this->render('AcmeDemoBundle:Welcome:index.html.twig');
|
||||
}
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace Acme\DemoBundle\DependencyInjection;
|
||||
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
|
||||
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
|
||||
use Symfony\Component\Config\FileLocator;
|
||||
|
||||
class AcmeDemoExtension extends Extension
|
||||
{
|
||||
public function load(array $configs, ContainerBuilder $container)
|
||||
{
|
||||
$loader = new XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
|
||||
$loader->load('services.xml');
|
||||
}
|
||||
|
||||
public function getAlias()
|
||||
{
|
||||
return 'acme_demo';
|
||||
}
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace Acme\DemoBundle\EventListener;
|
||||
|
||||
use Symfony\Component\EventDispatcher\Event;
|
||||
use Symfony\Component\HttpKernel\HttpKernelInterface;
|
||||
use Symfony\Component\HttpKernel\Event\FilterControllerEvent;
|
||||
use Acme\DemoBundle\Twig\Extension\DemoExtension;
|
||||
|
||||
class ControllerListener
|
||||
{
|
||||
protected $extension;
|
||||
|
||||
public function __construct(DemoExtension $extension)
|
||||
{
|
||||
$this->extension = $extension;
|
||||
}
|
||||
|
||||
public function onKernelController(FilterControllerEvent $event)
|
||||
{
|
||||
if (HttpKernelInterface::MASTER_REQUEST === $event->getRequestType()) {
|
||||
$this->extension->setController($event->getController());
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace Acme\DemoBundle\Form;
|
||||
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
|
||||
class ContactType extends AbstractType
|
||||
{
|
||||
public function buildForm(FormBuilderInterface $builder, array $options)
|
||||
{
|
||||
$builder->add('email', 'email');
|
||||
$builder->add('message', 'textarea');
|
||||
}
|
||||
|
||||
public function getName()
|
||||
{
|
||||
return 'contact';
|
||||
}
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" ?>
|
||||
|
||||
<container xmlns="http://symfony.com/schema/dic/services"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
|
||||
|
||||
<services>
|
||||
<service id="twig.extension.acme.demo" class="Acme\DemoBundle\Twig\Extension\DemoExtension" public="false">
|
||||
<tag name="twig.extension" />
|
||||
<argument type="service" id="twig.loader" />
|
||||
</service>
|
||||
|
||||
<service id="acme.demo.listener" class="Acme\DemoBundle\EventListener\ControllerListener">
|
||||
<tag name="kernel.event_listener" event="kernel.controller" method="onKernelController" />
|
||||
<argument type="service" id="twig.extension.acme.demo" />
|
||||
</service>
|
||||
</services>
|
||||
</container>
|
@ -0,0 +1,294 @@
|
||||
/*
|
||||
Copyright (c) 2010, Yahoo! Inc. All rights reserved.
|
||||
Code licensed under the BSD License:
|
||||
http://developer.yahoo.com/yui/license.html
|
||||
version: 2.8.2r1
|
||||
|
||||
Reset
|
||||
*/
|
||||
|
||||
html{color:#000;background:#FFF;}body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,code,form,fieldset,legend,input,button,textarea,p,blockquote,th,td{margin:0;padding:0;}table{border-collapse:collapse;border-spacing:0;}fieldset,img{border:0;}address,caption,cite,code,dfn,em,strong,th,var,optgroup{font-style:inherit;font-weight:inherit;}del,ins{text-decoration:none;}li{list-style:none;}caption,th{text-align:left;}h1,h2,h3,h4,h5,h6{font-size:100%;font-weight:normal;}q:before,q:after{content:'';}abbr,acronym{border:0;font-variant:normal;}sup{vertical-align:baseline;}sub{vertical-align:baseline;}legend{color:#000;}input,button,textarea,select,optgroup,option{font-family:inherit;font-size:inherit;font-style:inherit;font-weight:inherit;}input,button,textarea,select{*font-size:100%;}
|
||||
|
||||
html, body
|
||||
{
|
||||