Archives: December 13, 2018

[Solution] Symfony 3 easy translation

For twig base.html.twig : <p{{ 'message'|trans }}</p> Create or update your files translation : # tempate from app/Resources php bin/console translation:update --dump-messages --force fr php bin/console translation:update --dump-messages --force en # template from AppBundle/Resources php bin/console translation:update --dump-messages --force fr AppBundle php bin/console translation:update --dump-messages --force en AppBundle  

[Solution] Add Expires headers on Ubuntu

How to add expire header on Ubuntu with Apache2 : Edit your httpd.conf The module ‘mod_expires’ must be activated Add the new configuration 1) Activate mod_expires sudo a2enmod expires sudo /etc/init.d/apache2 restart 2) Add new lines on your httpd.conf nano /etc/apache2/apache2.conf Then add these lines at the end ExpiresActive On ExpiresByType image/gif “access 1 month”

Read More

[Solution] Symfony SwiftMailer multiple recipients

You can use an “array” : $to = array( "" => "User 1", "" => "User 2" );   Example : $subject = "User"; $to = array( "" => "User 1", "" => "User 2" ); $from = ""; $name = "Become Developer"; $body = "content"; $message = \Swift_Message::newInstance() ->setSubject($subject) ->setFrom($from) ->setTo($to) ->setBody($body) /* *

Read More

Symfony3 ClassNotFoundException after bundle creation

Il faut impĂ©rativement ajouter son bundle dans le fichier composer.json comme ceci par exemple   "autoload": { "psr-4": { "AppBundle\\": "src/AppBundle", "Acme\\Bundle\\BlogBundle\\": "src/Acme/Bundle/BlogBundle", "BlogBundle\\": "src/BlogBundle", "LangueBundle\\": "src/LangueBundle", "PaymentALBundle\\": "src/PaymentALBundle" }, "classmap": [ "app/AppKernel.php", "app/AppCache.php" ] }, Et puis exĂ©cuter cette commande : composer dumpautoload