When you start with symfony you probably use the Symfony Standard Edition.
This is a quite good start but there are somethings that helped me and might help you aswell.
Since every beginning is “schwer” :)
So here there are.
Continue reading “Symfony2 Starter Tweaks”
[Symfony 2] composer.json for a assumed-stable symfony 2 distribution
This small composer.json file is used in a project i am working on atm, feel free to use it at own risk. I will provide non-periodical updates and hopefully soon a full upgrade to symfony 2.1.x including doctrine orm 2.2.x.
I still did not get the point regarding dependency resolution, so i simply “composed” the composer file by writing down my own requirements (“i want only the hottest, newest stuff!!”, then tracked down the error messages, removing them by explicetly writing down the missing dependencies by using the latest “dev-*” versions. After that i tried to run the project, which actually did not work, but selective downgrade of some of the bundles (framework, security-extra blahblah) finally did the job. Continue reading “[Symfony 2] composer.json for a assumed-stable symfony 2 distribution”
modulo in Twig
Ever wondered how to use the modulo operator in twig, the template engine of symfony?
Actually its like in PHP:
{{ 11 % 7 }}
As described here
But i guess for most use cases modulus is used to check if a number is divisible by another number.
Therefore Twig has the very conveniant divisible by test function.
{% if loop.index is divisible by(3) %}
[Symfony 2][Twig] – Enabling (native) Twig Extensions
Twig Extensions is a tiny official repository for extensions to the Twig templating markup language, the default templating engine in each Symfony 2 (Standard Ed.) project. This short article shows how to purposeful enable them per-environment for your projects.
Continue reading “[Symfony 2][Twig] – Enabling (native) Twig Extensions”
Symfony 2 – Set Default Locale On Form Login #2
A small update/correction out of sequence:
In the meantime a non backwards compatible code modification has been introduced that outdated this article. From now on (Symfony 2.0.4) the locale and default locale settings are maintained within the request object (and not as used to be in the session).
So, here is a little update – under reserve – because the locale setting´s logic will probably change again in the future.
Continue reading “Symfony 2 – Set Default Locale On Form Login #2”
[Symfony 2] Twig – Global Variables
Schon mal gefragt, welche globalen Variablen in der Twig-Extension eines Symfony 2 (Standard Distri)-Projektes zur Verfügung stehen? Continue reading “[Symfony 2] Twig – Global Variables”
[Symfony 2] AsseticBundle, Less CSS & YUI Compressor unter OSX installieren
Das AsseticBundle ist ein Wrapper um Assetic, ein geniales Tool, um statische Assets für Webprojekte zu verwalten. AsseticBundle ist extrem einfach zu verwenden, einfach die entsprechende Filter-Chain via yaml konfigurieren, um mehr muss man sich nicht kümmern. Natürlich allerdings müssen die zugrundeliegenden Abhängigkeiten im Vorfeld installiert sein. In unserem Falle benötigen wir den Yui-Compressor als jar-File und Less CSS. Less ist ein node.js Modul, was bedingt, dass wir zuvor node.js installieren müssen.
Continue reading “[Symfony 2] AsseticBundle, Less CSS & YUI Compressor unter OSX installieren”
[Symfony 2] Security Bundle: Set User Locale on Form Login
[UPDATE]
A recent update to this article may be found here: https://nerdpress.org/symfony-2-set-default-locale-on-form-login-2/
Das Security Bundle ist ein wenig magisch. Da muss man eine HTML-Form definieren, der Rest wird irgendwie konfiguriert (Namen der Post-Parameter wie “_username”, “_password” etc., den Redirect zum Referrer, Remember-Me Funktion und so weiter, das alles wird von der Firewall intern geregelt. Man muss nur eine Login-Route definieren, einen Stub-Controller + Action-Callable (der aber nie ausgeführt wird, weil die Firefall sich davorhängt), fertig.
Das ist angenehm einfach, solange man keine Fragen stellt. Aber wie führe ich zusätzliche Aktionen direkt nach erfolgtem Login aus, ohne Einfuss auf den Code des Security Bundles zu haben?
Continue reading “[Symfony 2] Security Bundle: Set User Locale on Form Login”
[Symfony 2] Security Bundle – Benutzer mit username oder email anmelden.
Augenscheinlich unterstützt das Security-Module nur die Authentifizierung via Benutzername und Password. Wie man sich mit einem Benutzernamen ODER der E-Mail-Adresse und einem Password authentifiziert, ist ein wenig versteckt. So gehts:
Continue reading “[Symfony 2] Security Bundle – Benutzer mit username oder email anmelden.”
symfony 1.4 installer
Ich hab mal einen symfony 1.4 installer shell script auf github gepackt.
Damit kann man “ruckizucki” auf Ubuntu ein lokales symfony 1.4 Projekt aufsetzen.
Es ist ein fork von einem virtualhost create script und macht folgendes:
-
– holt den letzten symfony 1.4 stable release via svn
– setzt alle notwendigen rechte zB auf den cache folder
– bereitet die datenbank vor
– legt eine app an
– macht eine .gitignore
– und ruft das virtualhost creator script auf, was den vhost anlegt auf “web”