<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>admin | Nerdpress.org</title>
	<atom:link href="https://nerdpress.org/author/admin/feed/" rel="self" type="application/rss+xml" />
	<link>https://nerdpress.org</link>
	<description>...dev, tech problems and solutions.</description>
	<lastBuildDate>Fri, 06 Jan 2023 12:31:20 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>
	<item>
		<title>Nerdpress on Mastodon</title>
		<link>https://nerdpress.org/2023/01/06/nerdpress-on-mastodon/</link>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Fri, 06 Jan 2023 12:31:18 +0000</pubDate>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Mastodon]]></category>
		<guid isPermaLink="false">https://nerdpress.org/?p=3202</guid>

					<description><![CDATA[<p>We follow the PHP community and are now also Mastodon! Yay!Follow us here: https://phpc.social/@nerdpress_orgAll our Blog posts will be announced there as on Twitter. Since we blog a lot about PHP in general and Symfony in particular https://phpc.social seems like a good choice for us as our Mastodon instance. If you are a PHP nerd &#8230; </p>
<p class="link-more"><a href="https://nerdpress.org/2023/01/06/nerdpress-on-mastodon/" class="more-link">Continue reading<span class="screen-reader-text"> "Nerdpress on Mastodon"</span></a></p>
The post <a href="https://nerdpress.org/2023/01/06/nerdpress-on-mastodon/">Nerdpress on Mastodon</a> first appeared on <a href="https://nerdpress.org">Nerdpress.org</a>.]]></description>
										<content:encoded><![CDATA[<p>We follow the PHP community and are now also Mastodon! Yay!<br />Follow us here: <a href="https://phpc.social/@nerdpress_org" target="_blank" rel="noreferrer noopener">https://phpc.social/@nerdpress_org</a><br />All our Blog posts will be announced there as on Twitter.</p>



<p>Since we blog a lot about PHP in general and Symfony in particular <a href="https://phpc.social" target="_blank" rel="noreferrer noopener">https://phpc.social</a> seems like a good choice for us as our Mastodon instance.</p>



<span id="more-3202"></span>



<p>If you are a PHP nerd you might consider to join this instance as well.</p>



<p>Other fits could be:</p>



<ul class="wp-block-list">
<li><a href="https://phparch.social" target="_blank" rel="noreferrer noopener">https://phparch.social</a> the Mastodon instance of php[architect] Magazine</li>



<li><a href="https://fosstodon.org" target="_blank" rel="noreferrer noopener">https://fosstodon.org</a> it is a broader community around all OpenSource Software</li>



<li><a href="https://uiuxdev.social" target="_blank" rel="noreferrer noopener">https://uiuxdev.social</a> a more frontend resp. web development focused Mastodon community</li>
</ul>



<p>If you wonder how to find well know figures from the PHP scene on Mastodon Spatie&#8217;s Freek Van der Herten got you covered: <a href="https://freek.dev/2384-laravel-and-php-developers-to-follow-on-mastodon" target="_blank" rel="noreferrer noopener">https://freek.dev/2384-laravel-and-php-developers-to-follow-on-mastodon</a></p>



<p>Happy Tooting!</p>The post <a href="https://nerdpress.org/2023/01/06/nerdpress-on-mastodon/">Nerdpress on Mastodon</a> first appeared on <a href="https://nerdpress.org">Nerdpress.org</a>.]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Converting umlaute with symfony String component</title>
		<link>https://nerdpress.org/2022/07/18/converting-umlaute-with-symfony-string-component/</link>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Mon, 18 Jul 2022 10:03:11 +0000</pubDate>
				<category><![CDATA[Symfony]]></category>
		<category><![CDATA[umlaut]]></category>
		<guid isPermaLink="false">https://nerdpress.org/?p=3159</guid>

					<description><![CDATA[<p>There are multiple PHP native ways to convert umlaute and other special characters to ascii save formats, but most of them i experience insufficient in the one or other way. Since i am using symfony anyway i can use the String component which has a handy slugger which converts any characters into safe ascii characters.It &#8230; </p>
<p class="link-more"><a href="https://nerdpress.org/2022/07/18/converting-umlaute-with-symfony-string-component/" class="more-link">Continue reading<span class="screen-reader-text"> "Converting umlaute with symfony String component"</span></a></p>
The post <a href="https://nerdpress.org/2022/07/18/converting-umlaute-with-symfony-string-component/">Converting umlaute with symfony String component</a> first appeared on <a href="https://nerdpress.org">Nerdpress.org</a>.]]></description>
										<content:encoded><![CDATA[<p>There are multiple PHP native ways to convert umlaute and other special characters to ascii save formats, but most of them i experience insufficient in the one or other way.</p>



<p>Since i am using symfony anyway i can use the <a href="https://symfony.com/doc/current/components/string.html" target="_blank" rel="noreferrer noopener" title="https://symfony.com/doc/current/components/string.html">String component</a> which has a handy slugger which converts any characters into safe ascii characters.<br />It is very flexible and can be customized with locales, custom replacements and closures.</p>


<pre class="wp-block-code"><span><code class="hljs language-php">$umlautString = <span class="hljs-string">"Müller Meier"</span>;
$slugger = <span class="hljs-keyword">new</span> Symfony\Component\String\Slugger\AsciiSlugger(<span class="hljs-string">'de'</span>);
$slugger-&gt;slug($umlautString, $seperator = <span class="hljs-string">' '</span>)-&gt;toString();
<span class="hljs-keyword">echo</span> $umlautString; <span class="hljs-comment">// mueller meier</span></code></span></pre>


<p>I guess this will become my go-to method resp. slugger to convert umlaute in any PHP application.</p>



<span id="more-3159"></span>



<p>One example why the PHP native ways have their downsides is iconv.<br />Iconv can transliterate umlauts:</p>


<pre class="wp-block-code"><span><code class="hljs language-php">$string = iconv(<span class="hljs-string">'UTF-8'</span>, <span class="hljs-string">'ASCII//TRANSLIT'</span>, $string);</code></span></pre>


<p>But it can not handle the locale in a convenient way but relies on the system wide locale instead.<br />You need to use the global method <code>setlocale</code> before using it and reset the locale after usage again, which can cause sideeffects and is not very convenient.</p>



<p>From: <a href="https://www.php.net/manual/de/function.iconv.php#105507">https://www.php.net/manual/de/function.iconv.php#105507</a></p>


<pre class="wp-block-code"><span><code class="hljs language-php">$utf8_sentence = <span class="hljs-string">'Weiß, Göbel'</span>;
<span class="hljs-comment">//transliterate</span>
$trans_sentence = iconv(<span class="hljs-string">'UTF-8'</span>, <span class="hljs-string">'ASCII//TRANSLIT'</span>, $utf8_sentence);
<span class="hljs-comment">//gives &#91;Weiss, Gobel]</span>
<span class="hljs-comment">//Germany</span>
setlocale(LC_ALL, <span class="hljs-string">'de_DE'</span>);
$trans_sentence = iconv(<span class="hljs-string">'UTF-8'</span>, <span class="hljs-string">'ASCII//TRANSLIT'</span>, $utf8_sentence);
<span class="hljs-comment">//gives &#91;Weiss, Goebel]</span></code></span></pre>


<p>Thanks to this StackOverflow answer for the tip with the symfony String component. <a href="https://stackoverflow.com/a/68742023/541949" target="_blank" rel="noreferrer noopener">https://stackoverflow.com/a/68742023/541949</a></p>The post <a href="https://nerdpress.org/2022/07/18/converting-umlaute-with-symfony-string-component/">Converting umlaute with symfony String component</a> first appeared on <a href="https://nerdpress.org">Nerdpress.org</a>.]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>[Symfony 2][Assetic] Sass, CompassFilter + Foundation Responsive Front-end Framework</title>
		<link>https://nerdpress.org/2012/10/26/symfony-2assetic-sass-compassfilter-foundation-responsive-front-end-framework/</link>
					<comments>https://nerdpress.org/2012/10/26/symfony-2assetic-sass-compassfilter-foundation-responsive-front-end-framework/#comments</comments>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Fri, 26 Oct 2012 15:32:56 +0000</pubDate>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Frontend]]></category>
		<category><![CDATA[JS]]></category>
		<category><![CDATA[Silex]]></category>
		<category><![CDATA[Symfony]]></category>
		<category><![CDATA[Tools]]></category>
		<guid isPermaLink="false">https://nerdpress.org/?p=2323</guid>

					<description><![CDATA[<p>Did you ever wonder how to enable 3rd party plugins (or so called &#8220;frameworks&#8220;) within the great compass toolset managed by assetic in your edgy symfony 2.1 project? (If there is more extensive documentation available concerning assetic + CompassFilter, please stop reading on and let me know!) If you take a look at the filter &#8230; </p>
<p class="link-more"><a href="https://nerdpress.org/2012/10/26/symfony-2assetic-sass-compassfilter-foundation-responsive-front-end-framework/" class="more-link">Continue reading<span class="screen-reader-text"> "[Symfony 2][Assetic] Sass, CompassFilter + Foundation Responsive Front-end Framework"</span></a></p>
The post <a href="https://nerdpress.org/2012/10/26/symfony-2assetic-sass-compassfilter-foundation-responsive-front-end-framework/">[Symfony 2][Assetic] Sass, CompassFilter + Foundation Responsive Front-end Framework</a> first appeared on <a href="https://nerdpress.org">Nerdpress.org</a>.]]></description>
										<content:encoded><![CDATA[<p>Did you ever wonder how to enable 3rd <a href="http://compass-style.org/frameworks/">party</a> plugins (or so called &#8220;<a href="http://compass-style.org/frameworks/">frameworks</a>&#8220;) within the great <a href="http://compass-style.org/">compass toolset</a> managed by <a href="https://github.com/kriswallsmith/assetic">assetic</a> in your edgy <a href="http://symfony.com/">symfony 2.1</a> project?</p>
<p>(If there is more extensive documentation available concerning assetic + CompassFilter, please stop reading on and let me know!)</p>
<p>If you take a look at the filter class itself (it is CompassFilter in the generic Assetic\Filter namespace), you should recognise several option values that you can use in your application wide config.yml file.</p>
<p>But first you have to install the framework plugin following these <a href="http://foundation.zurb.com/docs/gem-install.php">instructions</a>.</p>
<p><span id="more-2323"></span></p>
<p>After adding the framework plugin by ruby&#8217;s own package manager &#8220;gem&#8221; (hopefully replaced by composer in the near future ;-)) by typing something like</p>
<pre class="brush: bash; title: ; notranslate">$ gem install zurb-foundation</pre>
<p>the only thing remaining to do is to load the framework plugin by assetic. To do so, put the folloging lines to your config.yml assetic section (as you would do it when using the compass command line interface, refer to the output of</p>
<pre class="brush: bash; title: ; notranslate">$ compass help compile</pre>
<p>.)</p>
<p>The yaml file should look like this:</p>
<pre class="brush: python; title: ; notranslate">
assetic:
    read_from: %kernel.root_dir%/web
    debug: %kernel.debug%
    use_controller: %kernel.debug%
    filters:
        compass:
            plugins: &#x5B;'zurb-foundation'] 
            # load foundation                                     
            # framework as you would do by typing
            # $ compass compile --require 
            # zurb-foundation &#x5B;...]
            # &#x5B; ... ]
</pre>
<p>Now you should be able to import the foundation library files by using the @import statement in your *.sass/*.scss files:</p>
<pre class="brush: css; title: ; notranslate">
@import &quot;foundation&quot;;
</pre>
<p>Have fun!</p>The post <a href="https://nerdpress.org/2012/10/26/symfony-2assetic-sass-compassfilter-foundation-responsive-front-end-framework/">[Symfony 2][Assetic] Sass, CompassFilter + Foundation Responsive Front-end Framework</a> first appeared on <a href="https://nerdpress.org">Nerdpress.org</a>.]]></content:encoded>
					
					<wfw:commentRss>https://nerdpress.org/2012/10/26/symfony-2assetic-sass-compassfilter-foundation-responsive-front-end-framework/feed/</wfw:commentRss>
			<slash:comments>2</slash:comments>
		
		
			</item>
		<item>
		<title>[Symfony 2] composer.json for a assumed-stable symfony 2 distribution</title>
		<link>https://nerdpress.org/2012/04/01/symfony-2-composer-json-for-a-assumed-stable-symfony-2-distribution/</link>
					<comments>https://nerdpress.org/2012/04/01/symfony-2-composer-json-for-a-assumed-stable-symfony-2-distribution/#comments</comments>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Sun, 01 Apr 2012 12:18:54 +0000</pubDate>
				<category><![CDATA[Doctrine ORM]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Project Setup]]></category>
		<category><![CDATA[Silex]]></category>
		<category><![CDATA[Symfony]]></category>
		<category><![CDATA[Twig]]></category>
		<category><![CDATA[composer.phar]]></category>
		<category><![CDATA[dependency management]]></category>
		<category><![CDATA[packagist]]></category>
		<category><![CDATA[symfony 2]]></category>
		<guid isPermaLink="false">https://nerdpress.org/?p=2118</guid>

					<description><![CDATA[<p>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 &#8220;composed&#8221; the &#8230; </p>
<p class="link-more"><a href="https://nerdpress.org/2012/04/01/symfony-2-composer-json-for-a-assumed-stable-symfony-2-distribution/" class="more-link">Continue reading<span class="screen-reader-text"> "[Symfony 2] composer.json for a assumed-stable symfony 2 distribution"</span></a></p>
The post <a href="https://nerdpress.org/2012/04/01/symfony-2-composer-json-for-a-assumed-stable-symfony-2-distribution/">[Symfony 2] composer.json for a assumed-stable symfony 2 distribution</a> first appeared on <a href="https://nerdpress.org">Nerdpress.org</a>.]]></description>
										<content:encoded><![CDATA[<p>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.</p>
<p>I still did not get the point regarding dependency resolution, so i simply &#8220;composed&#8221; the composer file by writing down my own requirements (&#8220;i want only the hottest, newest stuff!!&#8221;, then tracked down the error messages, removing them by explicetly writing down the missing dependencies by using the latest &#8220;dev-*&#8221; 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.<span id="more-2118"></span></p>
<p>Feel free to use it in your own projects:</p>
<pre class="brush: jscript; title: ; notranslate">
{
	&quot;require&quot; : {
              &quot;symfony/symfony&quot; : &quot;v2.0.12&quot;,
              &quot;doctrine/common&quot; : &quot;2.1.4&quot;,
              &quot;doctrine/orm&quot; : &quot;2.1.6&quot;,
              &quot;symfony/finder&quot; : &quot;v2.0.12&quot;,

              &quot;symfony/assetic-bundle&quot; : &quot;2.0-dev&quot;,
              &quot;twig/extensions&quot; : &quot;dev-master&quot;,
              &quot;jms/security-extra-bundle&quot; : &quot;1.1.0&quot;,
              &quot;sensio/framework-extra-bundle&quot; : &quot;2.0-dev&quot;,
              &quot;sensio/distribution-bundle&quot; : &quot;2.0-dev&quot;,
              &quot;sensio/generator-bundle&quot; : &quot;2.0-dev&quot;

 	},
        &quot;autoload&quot; : {
            &quot;psr-0&quot; : {
                &quot;Acme&quot; : &quot;src/&quot;,
            }
        }
}

</pre>
<p>Create a file named &#8220;composer.json&#8221; in your project&#8217;s root directory, then paste the above code into it and save it.</p>
<p>Now run</p>
<pre class="brush: bash; title: ; notranslate">
$ curl -s http://getcomposer.org/installer | php
</pre>
<p>After that, download all dependencies by typing</p>
<pre class="brush: bash; title: ; notranslate">
$ php composer.phar install
</pre>
<p>The easiest way to create a full project including AcmeDemoBundle, AppKernel and the whole stuff is to download the symfony 2 standard distribution without vendors and calling the script from there. The only thing to do is to modify the path to autoload.php, which should point to vendor/.composer/autoload.php.</p>
<p>Now you are able to upgrade your project&#8217;s dependencies to the newest versions by simply modifying the composer.json file. Have fun!.</p>The post <a href="https://nerdpress.org/2012/04/01/symfony-2-composer-json-for-a-assumed-stable-symfony-2-distribution/">[Symfony 2] composer.json for a assumed-stable symfony 2 distribution</a> first appeared on <a href="https://nerdpress.org">Nerdpress.org</a>.]]></content:encoded>
					
					<wfw:commentRss>https://nerdpress.org/2012/04/01/symfony-2-composer-json-for-a-assumed-stable-symfony-2-distribution/feed/</wfw:commentRss>
			<slash:comments>3</slash:comments>
		
		
			</item>
		<item>
		<title>thank gawd it’s online #3</title>
		<link>https://nerdpress.org/2011/10/21/thank-gawd-it-s-online-3/</link>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Fri, 21 Oct 2011 02:35:39 +0000</pubDate>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[linklist]]></category>
		<category><![CDATA[resources]]></category>
		<guid isPermaLink="false">https://nerdpress.org/?p=1860</guid>

					<description><![CDATA[<p>&#8230; aaaand these are the links: Dynamic &#8220;responsive&#8221; Texts: http://worrydream.com/Tangle/guide.html via (codediesel) When to use Silex or not!?  &#8230;incl. some nice discussions in the comments: http://test.ical.ly/2011/10/11/is-there-a-specific-situation-when-to-use-a-php-micro-framework-like-silex/ Flickrs Push API speech: http://code.flickr.com/blog/2011/10/11/talk-real-time-updates-on-the-cheap-for-fun-and-profit/ The World is my touchscreen http://www.gizmodo.de/2011/10/18/omnitouch-macht-die-welt-zum-touchscreen.html Can I Use&#8230; Compatibility tables for support of HTML5, CSS3, SVG and more in desktop and mobile browsers &#8230; </p>
<p class="link-more"><a href="https://nerdpress.org/2011/10/21/thank-gawd-it-s-online-3/" class="more-link">Continue reading<span class="screen-reader-text"> "thank gawd it’s online #3"</span></a></p>
The post <a href="https://nerdpress.org/2011/10/21/thank-gawd-it-s-online-3/">thank gawd it’s online #3</a> first appeared on <a href="https://nerdpress.org">Nerdpress.org</a>.]]></description>
										<content:encoded><![CDATA[<p>&#8230; aaaand these are the links:</p>
<p>Dynamic &#8220;responsive&#8221; Texts:<br />
<a href="http://worrydream.com/Tangle/guide.html"> http://worrydream.com/Tangle/guide.html</a><br />
via (<a href="http://www.codediesel.com/javascript/building-reactive-web-content/">codediesel</a>)</p>
<p>When to use Silex or not!?  &#8230;incl. some nice discussions in the comments:<br />
<a href="http://test.ical.ly/2011/10/11/is-there-a-specific-situation-when-to-use-a-php-micro-framework-like-silex/">http://test.ical.ly/2011/10/11/is-there-a-specific-situation-when-to-use-a-php-micro-framework-like-silex/<span id="more-1860"></span><br />
</a><br />
Flickrs Push API speech:<br />
<a href="http://code.flickr.com/blog/2011/10/11/talk-real-time-updates-on-the-cheap-for-fun-and-profit/">http://code.flickr.com/blog/2011/10/11/talk-real-time-updates-on-the-cheap-for-fun-and-profit/</a></p>
<p>The World is my touchscreen<br />
<a href="http://code.flickr.com/blog/2011/10/11/talk-real-time-updates-on-the-cheap-for-fun-and-profit/">http://www.gizmodo.de/2011/10/18/omnitouch-macht-die-welt-zum-touchscreen.html</a></p>
<p>Can I Use&#8230; Compatibility tables for support of HTML5, CSS3, SVG and more in desktop and mobile browsers<br />
<a href="http://www.gizmodo.de/2011/10/18/omnitouch-macht-die-welt-zum-touchscreen.html">http://www.gizmodo.de/2011/10/18/omnitouch-macht-die-welt-zum-touchscreen.html</a></p>
<p>The Googlher<br />
<a href="http://fffff.at/the-googlher/">http://fffff.at/the-googlher/</a></p>
<p>JS &#8211; jwerty &#8211; Awesome handling of keyboard events<br />
<a href="http://keithcirkel.co.uk/jwerty/">http://keithcirkel.co.uk/jwerty/</a></p>
<p>&nbsp;</p>The post <a href="https://nerdpress.org/2011/10/21/thank-gawd-it-s-online-3/">thank gawd it’s online #3</a> first appeared on <a href="https://nerdpress.org">Nerdpress.org</a>.]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>[Symfony 2][Twig] &#8211; Enabling (native) Twig Extensions</title>
		<link>https://nerdpress.org/2011/10/19/symfony-2-twig-enabling-native-twig-extensions/</link>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Wed, 19 Oct 2011 11:39:46 +0000</pubDate>
				<category><![CDATA[Deployment]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Project Setup]]></category>
		<category><![CDATA[Symfony]]></category>
		<category><![CDATA[Tools]]></category>
		<category><![CDATA[Dependency Injection]]></category>
		<category><![CDATA[DIC]]></category>
		<category><![CDATA[Extensions]]></category>
		<category><![CDATA[symfony 2]]></category>
		<category><![CDATA[Twig]]></category>
		<category><![CDATA[Twig Extension]]></category>
		<guid isPermaLink="false">https://nerdpress.org/?p=1899</guid>

					<description><![CDATA[<p>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. The twig-extension repository is usually fetched by calling $ bin/vendor install into your project´s ./vendor directory &#8230; </p>
<p class="link-more"><a href="https://nerdpress.org/2011/10/19/symfony-2-twig-enabling-native-twig-extensions/" class="more-link">Continue reading<span class="screen-reader-text"> "[Symfony 2][Twig] &#8211; Enabling (native) Twig Extensions"</span></a></p>
The post <a href="https://nerdpress.org/2011/10/19/symfony-2-twig-enabling-native-twig-extensions/">[Symfony 2][Twig] – Enabling (native) Twig Extensions</a> first appeared on <a href="https://nerdpress.org">Nerdpress.org</a>.]]></description>
										<content:encoded><![CDATA[<p><a href="https://github.com/fabpot/Twig-extensions">Twig Extensions</a> is a tiny official repository for extensions to the <a href="http://twig.sensiolabs.org/">Twig templating markup language</a>, 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.</p>
<p><span id="more-1899"></span></p>
<p>The twig-extension repository is usually fetched by calling</p>
<pre class="brush: bash; title: ; notranslate">
$ bin/vendor install
</pre>
<p>into your project´s ./vendor directory (because it is part of the ./deps file of each symfony 2 standard edition).</p>
<p>After installing the required vendor files, register the namespace fallback in your autoload.php (if you use the one delivered with Symfony 2 Standard, this should already have been done for you):</p>
<pre class="brush: php; title: ; notranslate">
use Symfony\Component\ClassLoader\UniversalClassLoader;
use Doctrine\Common\Annotations\AnnotationRegistry;

$loader = new UniversalClassLoader();
$loader-&gt;registerNamespaces(array(
    'Symfony'          =&gt; array(__DIR__.'/../vendor/symfony/src', __DIR__.'/../vendor/bundles'),
    // ...
));

$loader-&gt;registerPrefixes(array(
    'Twig_Extensions_' =&gt; __DIR__.'/../vendor/twig-extensions/lib',
    'Twig_'            =&gt; __DIR__.'/../vendor/twig/lib',
));
</pre>
<p>Remember that twig extensions are always registered as <a href="http://symfony.com/doc/2.0/book/service_container.html#tags-tags">tagged services</a>, but it is not always desirable to register a twig extension like e.g. the Debug-Extension as a regular service globally. We could do so by adding the service definition to the services.xml-file in one of our bundles. But due to the special purpose of the debug extension, we will choose a different, more &#8220;project-wide-configuration&#8221;-way.</p>
<p>Luckily, Symfony provides means to dynamically load services &#8220;on demand&#8221; and depending on the current <a href="http://symfony.com/doc/2.0/cookbook/configuration/environments.html">environment</a>.</p>
<p>Add the following lines to your app/config/config_dev.yml:</p>
<pre class="brush: python; title: ; notranslate">
services:
    debug.twig.extension:
        class: Twig_Extensions_Extension_Debug
        tags: &#x5B;{ name: 'twig.extension' }]
</pre>
<p>The &#8220;services&#8221;-configuration option may be utilized to register any class as a <a href="http://symfony.com/doc/2.0/book/service_container.html">DIC</a> managed <a href="http://symfony.com/doc/2.0/book/service_container.html#what-is-a-service">service</a>, for each project and independent from your bundle configuration (But remember that &#8220;regular&#8221; service definition configuration should usually happen in your bundle´s configuration files, otherwise you will not able to distribute your bundles because of missing or broken dependencies).</p>
<p>For twig extensions that should only be loaded for special purposes (like our DEBUG-function which is only needed in development environments), config_dev.yml is the perfect place to register them.</p>
<p>Note the &#8220;tags&#8221;-configuration which marks the service as a twig extension. Now, let´s create a demo twig-template and try the {% debug %} function:</p>
<pre class="brush: xml; title: ; notranslate">
{% extends &quot;NerdpressDemoBundle::layout.html.twig&quot; %}
{% debug %}
</pre>
<p>That will do. Open the page in your favorite webbrower (after defining a route, a controller and other stuff i won´t mention here) and admire the debug output. Note that the output will be much more nicer if you have had installed a native php debug extension like e.g. <a href="http://xdebug.org/">XDebug</a>.</p>The post <a href="https://nerdpress.org/2011/10/19/symfony-2-twig-enabling-native-twig-extensions/">[Symfony 2][Twig] – Enabling (native) Twig Extensions</a> first appeared on <a href="https://nerdpress.org">Nerdpress.org</a>.]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Symfony 2 &#8211; Set Default Locale On Form Login #2</title>
		<link>https://nerdpress.org/2011/10/13/symfony-2-set-default-locale-on-form-login-2/</link>
					<comments>https://nerdpress.org/2011/10/13/symfony-2-set-default-locale-on-form-login-2/#comments</comments>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Thu, 13 Oct 2011 16:14:05 +0000</pubDate>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Symfony]]></category>
		<category><![CDATA[Locale]]></category>
		<category><![CDATA[Request]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[Session]]></category>
		<category><![CDATA[symfony 2]]></category>
		<guid isPermaLink="false">https://nerdpress.org/?p=1891</guid>

					<description><![CDATA[<p>A small update/correction out of sequence: A few weeks ago i described how to hook into the form login process in order to change the user session´s locale. 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 &#8230; </p>
<p class="link-more"><a href="https://nerdpress.org/2011/10/13/symfony-2-set-default-locale-on-form-login-2/" class="more-link">Continue reading<span class="screen-reader-text"> "Symfony 2 &#8211; Set Default Locale On Form Login #2"</span></a></p>
The post <a href="https://nerdpress.org/2011/10/13/symfony-2-set-default-locale-on-form-login-2/">Symfony 2 – Set Default Locale On Form Login #2</a> first appeared on <a href="https://nerdpress.org">Nerdpress.org</a>.]]></description>
										<content:encoded><![CDATA[<p>A small update/correction out of sequence:</p>
<p><a href="https://nerdpress.org/2011/08/14/symfony-2-security-bundle-set-user-locale-on-form-login/">A few weeks ago i described how to hook into the form login process in order to change the user session´s locale.</a></p>
<p>In the meantime a non backwards compatible code modification has been <a href="http://symfony.com/blog/a-week-of-symfony-249-3-9-october-2011">introduced</a> 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).</p>
<p>So, here is a little update &#8211; under reserve &#8211; because the locale setting´s logic will probably <a href="https://github.com/symfony/symfony/commit/74bc699b270122b70b1de6ece47c726f5df8bd41">change again in the future</a>.</p>
<p><span id="more-1891"></span></p>
<p>At first, the new locale maintenance code by using a LocaleListener is <a href="https://github.com/symfony/symfony/issues/search?q=locale">still buggy</a>. Specially this issue breaks the whole thing atm: https://github.com/symfony/symfony/issues/2386</p>
<p>A quick workaround is to change the priority of the listener from 255 to let´s say 127. That forces the SessionListener to initialize the session right BEFORE the locale listener, so that $request->hasPreviousSession() has actually the chance to return TRUE.</p>
<p>Change Symfony\Component\HttpKernel\EventListener\LocaleListener, L. 69</p>
<pre class="brush: php; title: ; notranslate">
KernelEvents::REQUEST =&gt; array(array('onEarlyKernelRequest', 255), array('onKernelRequest', -1)),
</pre>
<p>to</p>
<pre class="brush: php; title: ; notranslate">
KernelEvents::REQUEST =&gt; array(array('onEarlyKernelRequest', 127), array('onKernelRequest', -1)),
</pre>
<p>Hopefully a patch will be available soon to fix the problem &#8211; source code modifications in this way are things YOU MUST NOT DO!</p>
<p>For now and demonstration purposes only, this will fit. After that, it´s easy to modify our <a href="https://nerdpress.org/2011/08/14/symfony-2-security-bundle-set-user-locale-on-form-login/">previously elaborated source code</a> to fit the new circumstances:</p>
<p>Change our listener from:</p>
<pre class="brush: php; title: ; notranslate">
class EventListener
{
    public function onSecurityInteractiveLogin(InteractiveLoginEvent $event)
    {
        $token = $event-&gt;getAuthenticationToken();
        $session = $event-&gt;getRequest()-&gt;getSession();
        $session-&gt;setLocale($token-&gt;getUser()-&gt;getLocale());
    }
}
</pre>
<p>into:</p>
<pre class="brush: php; title: ; notranslate">
class EventListener
{
    public function onSecurityInteractiveLogin(InteractiveLoginEvent $event)
    {
        $token = $event-&gt;getAuthenticationToken();
         
        $request = $event-&gt;getRequest();
        $session = $request-&gt;getSession();

        $locale = $token-&gt;getUser()-&gt;getLocale();
        $session-&gt;set('_locale', $locale);
        $request-&gt;setLocale($locale);
    }
}
</pre>
<p>I am still not sure if this is the best solution to the problem &#8211; hopefully the new implementation will be well documented in the future or changed in a way the produces less WTFs &#8230;</p>
<p>Any comments appreciated.</p>The post <a href="https://nerdpress.org/2011/10/13/symfony-2-set-default-locale-on-form-login-2/">Symfony 2 – Set Default Locale On Form Login #2</a> first appeared on <a href="https://nerdpress.org">Nerdpress.org</a>.]]></content:encoded>
					
					<wfw:commentRss>https://nerdpress.org/2011/10/13/symfony-2-set-default-locale-on-form-login-2/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
			</item>
		<item>
		<title>thank gawd it’s online #2</title>
		<link>https://nerdpress.org/2011/10/07/thank-gawd-it-s-online/</link>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Fri, 07 Oct 2011 02:20:42 +0000</pubDate>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[linklist]]></category>
		<category><![CDATA[links]]></category>
		<category><![CDATA[tgio]]></category>
		<guid isPermaLink="false">https://nerdpress.org/?p=1820</guid>

					<description><![CDATA[<p>it has been a nice week and those are the links: today some node.js resources: node, jquery and more http://dailyjs.com some cool tutorials http://howtonode.org/ two pro-firms thatwork with node and blog about it, great! http://blog.nodejitsu.com/ http://www.debuggable.com/blog and furthermore &#8230; Javascript text2speech (!) http://syntensity.com/static/espeak.html this weeks css3 generator looks shopped http://layerstyles.org/ HTML5 insertAdjacentHTML http://updates.html5rocks.com/2011/08/insertAdjacentHTML-Everywhere</p>
The post <a href="https://nerdpress.org/2011/10/07/thank-gawd-it-s-online/">thank gawd it’s online #2</a> first appeared on <a href="https://nerdpress.org">Nerdpress.org</a>.]]></description>
										<content:encoded><![CDATA[<p>it has been a nice week<br />
and those are the links:</p>
<p>today some node.js resources:<span id="more-1820"></span></p>
<p>node, jquery and more<br />
<a href="http://dailyjs.com">http://dailyjs.com</a></p>
<p>some cool tutorials<br />
<a id="internal-source-marker_0.17706814175471663" href="http://howtonode.org/">http://howtonode.org/</a></p>
<p>two pro-firms thatwork with node and blog about it, great!<br />
<a href="http://blog.nodejitsu.com/">http://blog.nodejitsu.com/<br />
</a><a id="internal-source-marker_0.17706814175471663" href="http://www.debuggable.com/blog">http://www.debuggable.com/blog</a></p>
<p>and furthermore &#8230;</p>
<p>Javascript text2speech (!)<br />
<a href="http://syntensity.com/static/espeak.html">http://syntensity.com/static/espeak.html</a></p>
<p>this weeks css3 generator looks shopped<br />
<a href="http://layerstyles.org/">http://layerstyles.org/</a></p>
<p>HTML5 insertAdjacentHTML<br />
<a href="http://updates.html5rocks.com/2011/08/insertAdjacentHTML-Everywhere">http://updates.html5rocks.com/2011/08/insertAdjacentHTML-Everywhere</a></p>The post <a href="https://nerdpress.org/2011/10/07/thank-gawd-it-s-online/">thank gawd it’s online #2</a> first appeared on <a href="https://nerdpress.org">Nerdpress.org</a>.]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>thank gawd it&#8217;s online #1</title>
		<link>https://nerdpress.org/2011/09/30/thank-god-it-s-online/</link>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Fri, 30 Sep 2011 02:35:40 +0000</pubDate>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[linklist]]></category>
		<category><![CDATA[links]]></category>
		<category><![CDATA[tgio]]></category>
		<guid isPermaLink="false">https://nerdpress.org/?p=1782</guid>

					<description><![CDATA[<p>Welcome to the first episode of our weekly link-list, which will appear every friday most likely on fridays. yet another CSS3 generator http://www.css3.me/ yet another CMS http://www.fork-cms.com/ article about PHP 5.4&#8217;s traits http://www.phpgangsta.de/der-klasse-neue-kleider-traits 40 SEO Strategies for Ecommerce Websites &#124; Kaiserthesage http://kaiserthesage.com/seo-strategies-for-ecommerce-websites-2/ Deploy your Silex and Twig powered Facebook App using Git onto free Heroku &#8230; </p>
<p class="link-more"><a href="https://nerdpress.org/2011/09/30/thank-god-it-s-online/" class="more-link">Continue reading<span class="screen-reader-text"> "thank gawd it&#8217;s online #1"</span></a></p>
The post <a href="https://nerdpress.org/2011/09/30/thank-god-it-s-online/">thank gawd it’s online #1</a> first appeared on <a href="https://nerdpress.org">Nerdpress.org</a>.]]></description>
										<content:encoded><![CDATA[<p>Welcome to the first episode of our weekly link-list, which will appear <del>every friday</del> most likely on fridays.<span id="more-1782"></span></p>
<p>yet another CSS3 generator<br />
<a href="http://www.css3.me/">http://www.css3.me/</a></p>
<p>yet another CMS<br />
<a href="http://www.fork-cms.com/">http://www.fork-cms.com/</a></p>
<p>article about PHP 5.4&#8217;s traits<br />
<a href="http://www.phpgangsta.de/der-klasse-neue-kleider-traits">http://www.phpgangsta.de/der-klasse-neue-kleider-traits</a></p>
<p>40 SEO Strategies for Ecommerce Websites | Kaiserthesage<br />
<a href="http://kaiserthesage.com/seo-strategies-for-ecommerce-websites-2/">http://kaiserthesage.com/seo-strategies-for-ecommerce-websites-2/</a></p>
<p>Deploy your Silex and Twig powered Facebook App using Git onto free Heroku Cloud Hosting<br />
<a href="http://test.ical.ly/2011/09/29/deploy-your-silex-and-twig-powered-facebook-app-using-git-onto-free-heroku-cloud-hosting/">http://test.ical.ly/2011/09/29/deploy-your-silex-and-twig-powered-facebook-app-using-git-onto-free-heroku-cloud-hosting/</a></p>
<p>Locks in Javascript?<br />
<a href="http://scriptstoprograms.wordpress.com/2011/09/27/javascript-shared-state/">http://scriptstoprograms.wordpress.com/2011/09/27/javascript-shared-state/</a></p>
<p>simple but powerful DRY Plugin/Effect Framework aimed to simplify your jQuery development such that you no longer have to repeat yourself.<br />
<a href="http://balupton.github.com/jquery-sparkle/demo/">http://balupton.github.com/jquery-sparkle/demo/</a></p>
<p>order pizza via command line<br />
<a href="http://www.youtube.com/watch?v=UUQzcqBxZJk">http://www.youtube.com/watch?v=UUQzcqBxZJk</a></p>
<p>&#8230;have a nice weekend!<br />
<a href="http://failblog.org/2011/09/27/epic-fail-photos-fail-blog-best-of-september-fails/">http://failblog.org/2011/09/27/epic-fail-photos-fail-blog-best-of-september-fails/</a></p>
<p>kthxbye<br />
<a href="http://en.wikipedia.org/wiki/Lolcode">http://en.wikipedia.org/wiki/Lolcode</a></p>The post <a href="https://nerdpress.org/2011/09/30/thank-god-it-s-online/">thank gawd it’s online #1</a> first appeared on <a href="https://nerdpress.org">Nerdpress.org</a>.]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>nerdpress language switch</title>
		<link>https://nerdpress.org/2011/09/16/nerdpress-language-switch/</link>
					<comments>https://nerdpress.org/2011/09/16/nerdpress-language-switch/#comments</comments>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Fri, 16 Sep 2011 06:05:17 +0000</pubDate>
				<category><![CDATA[Uncategorized]]></category>
		<guid isPermaLink="false">https://nerdpress.org/?p=1690</guid>

					<description><![CDATA[<p>As we also have more pageviews from outside germany lately and we&#8217;re happy about that, we have decided to continue posting in english from now on. Hope some of you might find it easier that way to figure out what the heck we&#8217;re talking about&#8230; Although our english is not quite perfect, we hope to &#8230; </p>
<p class="link-more"><a href="https://nerdpress.org/2011/09/16/nerdpress-language-switch/" class="more-link">Continue reading<span class="screen-reader-text"> "nerdpress language switch"</span></a></p>
The post <a href="https://nerdpress.org/2011/09/16/nerdpress-language-switch/">nerdpress language switch</a> first appeared on <a href="https://nerdpress.org">Nerdpress.org</a>.]]></description>
										<content:encoded><![CDATA[<p>As we also have more pageviews from outside germany lately and we&#8217;re happy about that,<br />
we have decided to continue posting in english from now on.</p>
<p><span id="more-1690"></span></p>
<p>Hope some of you might find it easier that way to figure out what the heck we&#8217;re talking about&#8230;</p>
<p><object style="height: 390px; width: 640px;" width="640" height="390" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowFullScreen" value="true" /><param name="allowScriptAccess" value="always" /><param name="src" value="http://www.youtube.com/v/cYPkbUfumWU?version=3" /><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><embed style="height: 390px; width: 640px;" width="640" height="390" type="application/x-shockwave-flash" src="https://www.youtube.com/v/cYPkbUfumWU?version=3" allowFullScreen="true" allowScriptAccess="always" allowfullscreen="true" allowscriptaccess="always" /></object></p>
<p>Although our english is not quite perfect, we hope to beat google translator in that job ;)</p>The post <a href="https://nerdpress.org/2011/09/16/nerdpress-language-switch/">nerdpress language switch</a> first appeared on <a href="https://nerdpress.org">Nerdpress.org</a>.]]></content:encoded>
					
					<wfw:commentRss>https://nerdpress.org/2011/09/16/nerdpress-language-switch/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
			</item>
	</channel>
</rss>
