German php resource phpgangsta.de collected a nice list of slide from Symfony Live Paris 2011.
Slides, You should really keep an eye on:
Symfony2 – from the trenches
by Lukas Kahwe Smith, Jordi Boggiano, Jeremy Mikola
Introducing Assetic: Asset Management for PHP 5.3
by Kris Wallsmith
UserBundle (sfGuard for Symfony2)
by Jeremy Mikola
Monolog
by Jordi Boggiano
Being dangerous with Twig
by Ryan Weaver
Behavior Driven Development for Symfony2 (with behat)
by Konstantin Kudryashov
(via phpgangsta.de)
Tuesday, March 22, 2011
WebProfilerBundleExtra - or how to boost Symfony2 WebProfiler from awesome to double awesome
Developer Vincent Bouzeran (Twitter, Github) created some nifty Bundle called 'WebProfilerExtraBundle' that extends the Symfony2 web profiler and provieds support for the components:- Assetic
- Container
- Routing
- Twig
(Tested with Symfony2 PR8)
Monday, March 21, 2011
Syntax highlighting Twig templates in Redcar/Textmate
If your favourite IDE/editor is Textmate or Redcar this could be something for you.
Today I found a dyntax highlighting Textmate bundle for Twig. You can download it directly from github. Just put the contents of the archive in a folder and name it php-twig.tmbundle.
Bundle installation instructions for Textmate can be found here and for Redcar here.
Today I found a dyntax highlighting Textmate bundle for Twig. You can download it directly from github. Just put the contents of the archive in a folder and name it php-twig.tmbundle.
Bundle installation instructions for Textmate can be found here and for Redcar here.
Friday, February 11, 2011
How to free Symfony2 from the sandbox tutorial (with some help from Git)
Note
It's possible that this tutorial works no more, because of changes made to Symfony2 after release PR6.
----
The Symfony2 sandbox application is a great base to start digging into writing Symfony2 apps. When I tried to get my first overview of how to build an app with Symfony2 I just downloaded the symfony2-sandbox from https://github.com/symfony/symfony-sandbox/archives/master and extracted it somewhere onto my development machine, lets assume our folder is sven@dev:~/sandbox$
Prerequisites:
Hello Git, how are you :)
Create a new local git repository with git init:
(No need now for a remote repository)
sven@dev:~/sandbox$ git init
Goodbye vendors, Hello vendors!
SVN had svn-externals, Git has submodules, so we can make our lives a little bit easier and make use of git submodules to include all vendors as independent git repositories, called submodules. To achieve this we have to execute the command git submodule add <repository-url> <checkout-directory>.
Just execute the following list line by line on your command line:
sven@dev:~/sandbox$
Now you have included every dependency to a vendor as a seperate git repository, now just call git submodule update --init to update everything.
sven@dev:~/sandbox$ git submodule update --init
You like it slow?
Symfony2 has a bootstrap file under ~/sandbox/vendor/symfony/src/Symfony/Component/HttpKernel/bootstrap.php which includes the whole framework for maximum performance, so it never loads the real classes under vendor/symfony/src/Symfony, for debugging and testing it can be useful to include the real classes and not the bootstrap file, for this you need to change two files:
1: sven@dev:~/sandbox/app/bootstrap.php
Comment out the line:
2: sven@dev:~/sandbox/app/autoload.php
Add at the beginning of the file the following line:
More to delete, just to be up to date
Delete the contents of sven@dev:~/sandbox/bin$ and create a new folder called ant-tasks and a new file called update-vendors.xml. Paste the following content into the file:
This file is an ant tasks file, you can execute the tasks described in there with ant to update your vendors.
Done
Now make your sandbox folder accessible by your webserver and navigate to the web folder and open the app.php or app_dev.php file in your browser, Symfony2 should running without any problems.
Another tip about git submodules
Sometimes it's a bit dangerous to get the most bleeding edge checkouts from the vendors, so you can update the sources/submodules and after that, navigate into the checkout folder and switch to a tag with git checkout <tag_name>.
It's possible that this tutorial works no more, because of changes made to Symfony2 after release PR6.
----
The Symfony2 sandbox application is a great base to start digging into writing Symfony2 apps. When I tried to get my first overview of how to build an app with Symfony2 I just downloaded the symfony2-sandbox from https://github.com/symfony/symfony-sandbox/archives/master and extracted it somewhere onto my development machine, lets assume our folder is sven@dev:~/sandbox$
Prerequisites:
- Git installed, check
Hello Git, how are you :)
Create a new local git repository with git init:
(No need now for a remote repository)
sven@dev:~/sandbox$ git init
Goodbye vendors, Hello vendors!
SVN had svn-externals, Git has submodules, so we can make our lives a little bit easier and make use of git submodules to include all vendors as independent git repositories, called submodules. To achieve this we have to execute the command git submodule add <repository-url> <checkout-directory>.
Just execute the following list line by line on your command line:
sven@dev:~/sandbox$
git submodule add git://github.com/symfony/symfony.git vendor/symfony git submodule add git://github.com/fabpot/Twig.git vendor/twig git submodule add git://github.com/fabpot/Twig-extensions.git vendor/twig-extensions git submodule add git://github.com/doctrine/common.git vendor/doctrine-common git submodule add git://github.com/doctrine/doctrine2.git vendor/doctrine git submodule add git://github.com/doctrine/dbal.git vendor/doctrine-dbal git submodule add git://github.com/doctrine/data-fixtures.git vendor/doctrine-data-fixtures git submodule add git://github.com/doctrine/migrations.git vendor/doctrine-migrations git submodule add git://github.com/doctrine/mongodb.git vendor/doctrine-mongodb git submodule add git://github.com/doctrine/mongodb-odm.git vendor/doctrine-mongodb-odm git submodule add git://github.com/swiftmailer/swiftmailer.git vendor/swiftmailer git submodule add git://github.com/zendframework/zf2.git vendor/zend
Now you have included every dependency to a vendor as a seperate git repository, now just call git submodule update --init to update everything.
sven@dev:~/sandbox$ git submodule update --init
You like it slow?
Symfony2 has a bootstrap file under ~/sandbox/vendor/symfony/src/Symfony/Component/HttpKernel/bootstrap.php which includes the whole framework for maximum performance, so it never loads the real classes under vendor/symfony/src/Symfony, for debugging and testing it can be useful to include the real classes and not the bootstrap file, for this you need to change two files:
1: sven@dev:~/sandbox/app/bootstrap.php
Comment out the line:
require_once __DIR__.'/../vendor/symfony/src/Symfony/Component/HttpKernel/bootstrap.php';2: sven@dev:~/sandbox/app/autoload.php
Add at the beginning of the file the following line:
require_once(__DIR__ . '/../vendor/symfony/src/Symfony/Component/ClassLoader/UniversalClassLoader.php');More to delete, just to be up to date
Delete the contents of sven@dev:~/sandbox/bin$ and create a new folder called ant-tasks and a new file called update-vendors.xml. Paste the following content into the file:
<project name="update-vendors" basedir="./../../">
<target name="update-doctrine">
<exec dir="${basedir}/vendor/doctrine" executable="git" failonerror="true">
<arg line="pull" />
</exec>
</target>
<target name="update-doctrine-common">
<exec dir="${basedir}/vendor/doctrine-common" executable="git" failonerror="true">
<arg line="pull" />
</exec>
</target>
<target name="update-doctrine-dbal">
<exec dir="${basedir}/vendor/doctrine-dbal" executable="git" failonerror="true">
<arg line="pull" />
</exec>
</target>
<target name="update-doctrine-data-fixtures">
<exec dir="${basedir}/vendor/doctrine-data-fixtures" executable="git" failonerror="true">
<arg line="pull" />
</exec>
</target>
<target name="update-doctrine-migrations">
<exec dir="${basedir}/vendor/doctrine-migrations" executable="git" failonerror="true">
<arg line="pull" />
</exec>
</target>
<target name="update-doctrine-mongodb">
<exec dir="${basedir}/vendor/doctrine-mongodb" executable="git" failonerror="true">
<arg line="pull" />
</exec>
</target>
<target name="update-doctrine-mongodb-odm">
<exec dir="${basedir}/vendor/doctrine-mongodb-odm" executable="git" failonerror="true">
<arg line="pull" />
</exec>
</target>
<target name="update-symfony">
<exec dir="${basedir}/vendor/symfony" executable="git" failonerror="true">
<arg line="pull" />
</exec>
</target>
<target name="update-twig">
<exec dir="${basedir}/vendor/twig" executable="git" failonerror="true">
<arg line="pull" />
</exec>
</target>
<target name="update-twig-extensions">
<exec dir="${basedir}/vendor/twig-extensions" executable="git" failonerror="true">
<arg line="pull" />
</exec>
</target>
<target name="update-swiftmailer">
<exec dir="${basedir}/vendor/swiftmailer" executable="git" failonerror="true">
<arg line="pull" />
</exec>
</target>
<target name="update-zend">
<exec dir="${basedir}/vendor/zend" executable="git" failonerror="true">
<arg line="pull" />
</exec>
</target>
</project>
This file is an ant tasks file, you can execute the tasks described in there with ant to update your vendors.
Done
Now make your sandbox folder accessible by your webserver and navigate to the web folder and open the app.php or app_dev.php file in your browser, Symfony2 should running without any problems.
Another tip about git submodules
Sometimes it's a bit dangerous to get the most bleeding edge checkouts from the vendors, so you can update the sources/submodules and after that, navigate into the checkout folder and switch to a tag with git checkout <tag_name>.
Thursday, February 10, 2011
Subscribe to:
Posts (Atom)