This section provides an overview of what Symfony2 is and why a developer might want to use it.
It should also mention any large subjects within Symfony2 and link out to the related topics. Since the Documentation for Symfony2 is new, you may need to create initial versions of those related topics.
The latest stable version during the time of writing is Symfony 3.1 which will be maintained until end of July 2017.
Symfony has Long Term Support versions which are maintained for a total of 4 years (3 years for bug fixes, 1 additional year for security bug fixes)
A Standard Minor Version is maintained for an eight month period for bug fixes, and for a fourteen month period for security issue fixes.
Long Term Support versions:
Symfony 2.3 - May 2016 end of support for bug fixes
May 2017 end of support for security fixes(end of life)
Symfony 2.7 - May 2018 end of support for bug fixes
May 2019 end of support for security fixes(end of life)
Symfony 2.8 - November 2018 end of support for bug fixes
November 2019 end of support for security fixes(end of life)
Starting from 3.X version, minor versions will be limited to 5 and the last minor version will be LTS.
Syfmony has dual maintenance mode, releasing minor versions ever six months once in May and once in November. Major version are released every two years, meaning there will be one year time period to move form the previous major version to the latest one, giving user a choice between the latest features of standard version or an LTS version that is supported for bug fixes.
Symfony maintains strict backward compatibility, anything that breaks BC is done in the next major version. A feature implementation that is an improvement but breaks BC is kept alongside the old implementation which will be deprecated
Read more about versions and development process in detail from the official documentation [here][1]
[1]: http://symfony.com/doc/current/contributing/community/releases.html| Version | Release Date | | ------- | ------------ | | 2.3.0 | 2013-06-03 | | 2.7.0 | 2015-05-30 | | 2.8.0 | 2015-11-30 |
Symfony Framework - built with symfony components, is one of the leading PHP framework used to create robust websites and web applications.
Symfony can be installed quickly through two recommended ways.
On Linux/Mac OS X run the following commands:
$ sudo curl -LsS https://symfony.com/installer -o /usr/local/bin/symfony
$ sudo chmod a+x /usr/local/bin/symfony
On Windows move to the project directory and run the following command:
php -r "file_put_contents('symfony', file_get_contents('https://symfony.com/installer'));"
symfony project can be created by running symfony new my_project [2.8]
on Linux/Mac OS X
On Windows php symfony new my_project [2.8]
or alternatively symfony new my_project lts
will use the latest long-term support version of Symfony.
Use Composer's create-project
command to download Symfony
composer create-project symfony/framework-standard-edition my_project_name ["2.8.*"]
Excellent detailed official documentation here
For starting symfony internal web server (available since PHP 5.4), go to the project directory and execute this command:
for symfony<=2.8
php app/console server:start
and for symfony >=3.0
php bin/console server:start
This starts the web server at localhost:8000
in the background that serves your Symfony application. Then, open your browser and access the http://localhost:8000/
URL to see the Symfony welcome page:
Checking Requirements
Run bin/symfony_requirements
for checking symfony requirements and php cli setting. Install all packages that needed to run a symfony project. Setting your php.ini for example setting timezone and short_open_tag. Setting both php.ini for your php webserver (eg: /etc/php/apache2/php.ini) and php cli (eg: /etc/php/cli/php.ini). Open http://localhost/config.php for checking php webserver setting. If everything has passed, you are ready to run your symfony project.
Running Project
Run composer install
to install all depedencies. Then setting up permission for var/cache
, var/logs
and var/sessions
.
Detailed official documentation here
<?php
// src/AppBundle/Controller/MyController.php
namespace AppBundle\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Symfony\Component\HttpFoundation\Response;
class MyController
{
/**
* @Route("/hello")
*/
public function myHelloAction()
{
return new Response(
'<html><body>
I\'m the response for request <b>/hello</b>
</body></html>'
);
}
}
NOTE: All controller classes should have ends with word 'Controller' and methods related to routs should ends with word 'Action'. Further, In which controller your Actions are placed is not relevant until you define a rout prefix for the controller.