<?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>silex | Nerdpress.org</title>
	<atom:link href="https://nerdpress.org/tag/silex-2/feed/" rel="self" type="application/rss+xml" />
	<link>https://nerdpress.org</link>
	<description>...dev, tech problems and solutions.</description>
	<lastBuildDate>Fri, 12 Feb 2016 08:06:35 +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>Superleansilexplate Update v3</title>
		<link>https://nerdpress.org/2016/02/11/superleansilexplate-update-v3/</link>
		
		<dc:creator><![CDATA[Ivo Bathke]]></dc:creator>
		<pubDate>Thu, 11 Feb 2016 17:15:52 +0000</pubDate>
				<category><![CDATA[Silex]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[docker]]></category>
		<category><![CDATA[silex]]></category>
		<category><![CDATA[superleansilexplate]]></category>
		<guid isPermaLink="false">https://nerdpress.org/?p=2667</guid>

					<description><![CDATA[<p>Some news from the Superleansilexplate: v3 now uses symfony3 components Silex 1.3 supports symfony3 so lets use it :) Note: as symfony3 doesnt support php5.4 anymore, we dont either! new ConsoleServiceProvider the one from knplabs that was used before seems to be unmaintained and wasnt matching the dependencies anymore. So i decided to take it &#8230; </p>
<p class="link-more"><a href="https://nerdpress.org/2016/02/11/superleansilexplate-update-v3/" class="more-link">Continue reading<span class="screen-reader-text"> "Superleansilexplate Update v3"</span></a></p>
The post <a href="https://nerdpress.org/2016/02/11/superleansilexplate-update-v3/">Superleansilexplate Update v3</a> first appeared on <a href="https://nerdpress.org">Nerdpress.org</a>.]]></description>
										<content:encoded><![CDATA[<p>Some news from the <a href="https://github.com/ivoba/superleansilexplate" target="_blank">Superleansilexplate</a>:</p>
<ul>
<li>v3 now uses symfony3 components<br />
  Silex 1.3 supports symfony3 so lets use it :)<br />
  Note: as symfony3 doesnt support php5.4 anymore, we dont either!</li>
<li>new <a href="https://github.com/ivoba/console-service-provider" target="_blank">ConsoleServiceProvider</a><br />
  the one from <a href="https://github.com/KnpLabs/ConsoleServiceProvider" target="_blank">knplabs</a> that was used before seems to be unmaintained and wasnt matching the dependencies anymore.<br />
  So i decided to take it over and renew it a bit. Check it out!</li>
<li>Docker support<br />
  I started to use Docker as dev enviroment for my projects, so i added dev &#038; prod Docker support.<br />
  For the sake of simplicity it uses a single container with Apache and PHP7.<br />
  If you have Docker and docker-compose on your machine just spin it up with <code>docker-compose up</code> and check on localhost:8088.</li>
</ul>
<p><span id="more-2667"></span></p>
<p>As a quick outview:<br />
we are all waiting for Silex2, but development seems to stagnate there.<br />
Hopefully it will pace up again.<br />
But with the rise of other MicroFrameworks like <a href="https://lumen.laravel.com/" target="_blank">Lumen</a> or the <a href="http://symfony.com/blog/new-in-symfony-2-8-symfony-as-a-microframework" target="_blank">symfony MicroKernel</a>, things went all a bit quiet around Silex.<br />
As i use symfony quite a lot i personally tend to symfony MicroKernel these days.<br />
Check out this <a href="https://www.symfony.fi/entry/symfony-benchmarks-microkernel-silex-lumen-and-slim" target="_blank">blogpost</a> for a benchmark of the microframeworks. </p>The post <a href="https://nerdpress.org/2016/02/11/superleansilexplate-update-v3/">Superleansilexplate Update v3</a> first appeared on <a href="https://nerdpress.org">Nerdpress.org</a>.]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Enable Twig-Extensions in Silex revisited</title>
		<link>https://nerdpress.org/2014/05/05/enable-twig-extensions-silex-revisited/</link>
		
		<dc:creator><![CDATA[Ivo Bathke]]></dc:creator>
		<pubDate>Mon, 05 May 2014 16:20:51 +0000</pubDate>
				<category><![CDATA[Silex]]></category>
		<category><![CDATA[Twig]]></category>
		<category><![CDATA[silex]]></category>
		<category><![CDATA[Twig Extension]]></category>
		<guid isPermaLink="false">https://nerdpress.org/?p=2545</guid>

					<description><![CDATA[<p>As of 2014 things have changed improved a lot in the Symfony / Silex world, compared to 2011, when i first blogged about twig extensions in Silex. Things got more easy, yay! As Composer appeared, installation and autoloading is a breeze nowadays. I presume here, that you have installed your Silex project via composer. If &#8230; </p>
<p class="link-more"><a href="https://nerdpress.org/2014/05/05/enable-twig-extensions-silex-revisited/" class="more-link">Continue reading<span class="screen-reader-text"> "Enable Twig-Extensions in Silex revisited"</span></a></p>
The post <a href="https://nerdpress.org/2014/05/05/enable-twig-extensions-silex-revisited/">Enable Twig-Extensions in Silex revisited</a> first appeared on <a href="https://nerdpress.org">Nerdpress.org</a>.]]></description>
										<content:encoded><![CDATA[<p>As of 2014 things have <del datetime="2014-05-05T16:12:03+00:00">changed</del> improved a lot in the Symfony / Silex world, compared to 2011, when <a href="https://nerdpress.org/2011/11/21/enable-twig-extensions-in-silex/">i first blogged about twig extensions in Silex</a>.<br />
Things got more easy, yay!</p>
<p>As Composer appeared, installation and autoloading is a breeze nowadays.<br />
I presume here, that you have installed your Silex project via composer.<br />
If so, you can install the twig extensions like this:<br />
<span id="more-2545"></span><br />
Just go to your project folder and run:</p>
<pre class="brush: plain; title: ; notranslate">composer require twig/extensions:~1.0</pre>
<p>and your done with installation and autoloading.</p>
<p>Now to integration and service registration, this also got more easy.</p>
<p>Place this after you have registered the twig service:</p>
<pre class="brush: php; title: ; notranslate">$app&#x5B;'twig'] = $app-&gt;share($app-&gt;extend('twig', function($twig, $app) {
    $twig-&gt;addExtension(new Twig_Extensions_Extension_Text($app));
    return $twig;
}));</pre>
<p>Thats it, now you can use the text filters in your twig templates:</p>
<pre class="brush: plain; title: ; notranslate">
{{ post.content|truncate(200)|raw }}</pre>
<p>Easy&#8230;</p>The post <a href="https://nerdpress.org/2014/05/05/enable-twig-extensions-silex-revisited/">Enable Twig-Extensions in Silex revisited</a> first appeared on <a href="https://nerdpress.org">Nerdpress.org</a>.]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Silex and MongoDB simply</title>
		<link>https://nerdpress.org/2012/01/30/silex-and-mongodb-simply/</link>
					<comments>https://nerdpress.org/2012/01/30/silex-and-mongodb-simply/#comments</comments>
		
		<dc:creator><![CDATA[Ivo Bathke]]></dc:creator>
		<pubDate>Mon, 30 Jan 2012 14:27:34 +0000</pubDate>
				<category><![CDATA[Doctrine ORM]]></category>
		<category><![CDATA[MongoDB]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Silex]]></category>
		<category><![CDATA[Doctrine]]></category>
		<category><![CDATA[mongodb]]></category>
		<category><![CDATA[silex]]></category>
		<guid isPermaLink="false">https://nerdpress.org/?p=2033</guid>

					<description><![CDATA[<p>Using MongoDB in your Silex Project is quite easy. I will show this with my Superleansilexplate and will integrate it there as an example. Since i dont want to integrate MongoDB in Superleansilexplate it will just become an additional gist. Given you have some smaller amount of data like a counter that needs to be &#8230; </p>
<p class="link-more"><a href="https://nerdpress.org/2012/01/30/silex-and-mongodb-simply/" class="more-link">Continue reading<span class="screen-reader-text"> "Silex and MongoDB simply"</span></a></p>
The post <a href="https://nerdpress.org/2012/01/30/silex-and-mongodb-simply/">Silex and MongoDB simply</a> first appeared on <a href="https://nerdpress.org">Nerdpress.org</a>.]]></description>
										<content:encoded><![CDATA[<p>Using MongoDB in your Silex Project is quite easy.</p>
<p>I will show this with my <a href="https://github.com/ivoba/superleansilexplate">Superleansilexplate</a> and will integrate it there as an example.<br />
Since i dont want to integrate MongoDB in Superleansilexplate it will just become an additional <a href="https://gist.github.com/1704512">gist</a>.</p>
<p>Given you have some smaller amount of data like a counter that needs to be stored or other loose coupled datasets, we simply speak to MongoDB &#8220;directly&#8221; and store the data via <a href="https://github.com/doctrine/mongodb">Doctrine MongoDB Abstraction Layer</a>.<br />
Since i presume the Data / Document Structure isnt that complex we dont use <a href="https://github.com/doctrine/mongodb-odm">Doctrine MongoDB ODM</a> (the Object Document Mapper).<br />
If you want to use it instead, try this <a href="https://github.com/docteurklein/SilexExtensions">Silex Extensions</a>.</p>
<p><span id="more-2033"></span></p>
<p>So we use this <a href="https://github.com/fate/Silex-Extensions">SilexExtensions</a> collection and install it via git:</p>
<pre class="brush: bash; title: ; notranslate">
 cd mysilexproject
 git clone git@github.com:fate/Silex-Extensions.git vendor/silex-extension
</pre>
<p>Then we install the doctrine mongodb libary manually:</p>
<pre class="brush: bash; title: ; notranslate">
 git clone --recursive https://github.com/doctrine/mongodb vendor/mongodb
</pre>
<p>The extension collection has some more poviders but you can just ignore them and just focus on the MongoDbExtension.</p>
<p>&#8211;<em> i actually dont like extensions collections. i would prefer to clone each extensions individually. thou its not much code overhead, but when it comes to the vendor dependencies it can become quite messy IMHO</em> &#8211;</p>
<p>Alright now the code.<br />
Edit src/app.php and register the namespace for the extension:</p>
<pre class="brush: php; title: ; notranslate">
 $app&#x5B;'autoloader']-&gt;registerNamespace('SilexExtension', __DIR__ . '/../vendor/silex-extension/src');
</pre>
<p>Then register the MongoDbExtension;</p>
<pre class="brush: php; title: ; notranslate">
 $app-&gt;register(new SilexExtension\MongoDbExtension(), array(
 'mongodb.class_path' =&gt; __DIR__ . '/../vendor/mongodb/lib',
 'mongodb.connection' =&gt; array(
 'server' =&gt; 'mongodb://mysecretuser:mysecretpassw@localhost',
 'options' =&gt; array(),
 'eventmanager' =&gt; function($eventmanager) {
 }
 )
 ));
</pre>
<p>and finally query your MongoDB collection of choice and display the resultset as json:</p>
<pre class="brush: php; title: ; notranslate">
$app-&gt;get('/data-from-mongodb', function() use($app) {

$coll = $app&#x5B;'mongodb']-&gt;selectDatabase('mydb')-&gt;selectCollection('mycoll');
 $query = array(
 'query' =&gt; 'value'
 );
 $sort = array(
 'count' =&gt; -1,
 );
 $r = $coll-&gt;find($query)-&gt;sort($sort)-&gt;toArray();
 $response = new Response();
 $response-&gt;headers-&gt;set('Content-type', 'application/json');
 $response-&gt;setContent(json_encode($r));
 return $response;
 });
</pre>
<p>Easy</p>The post <a href="https://nerdpress.org/2012/01/30/silex-and-mongodb-simply/">Silex and MongoDB simply</a> first appeared on <a href="https://nerdpress.org">Nerdpress.org</a>.]]></content:encoded>
					
					<wfw:commentRss>https://nerdpress.org/2012/01/30/silex-and-mongodb-simply/feed/</wfw:commentRss>
			<slash:comments>2</slash:comments>
		
		
			</item>
		<item>
		<title>Silex Starter Stubs</title>
		<link>https://nerdpress.org/2011/11/04/silex-starter-stubs/</link>
					<comments>https://nerdpress.org/2011/11/04/silex-starter-stubs/#comments</comments>
		
		<dc:creator><![CDATA[Ivo Bathke]]></dc:creator>
		<pubDate>Fri, 04 Nov 2011 14:01:46 +0000</pubDate>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Silex]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Ant]]></category>
		<category><![CDATA[h5bp]]></category>
		<category><![CDATA[silex]]></category>
		<category><![CDATA[skeleton]]></category>
		<guid isPermaLink="false">https://nerdpress.org/?p=1924</guid>

					<description><![CDATA[<p>There are several preconfigured Silex Apps on github. They let you start your Silex project in no time, which is good. This makes Silex an even more simple rabbithole into the symfony2 world. I started one myself and had a close look on the others, so i thought i share this. They all differ a &#8230; </p>
<p class="link-more"><a href="https://nerdpress.org/2011/11/04/silex-starter-stubs/" class="more-link">Continue reading<span class="screen-reader-text"> "Silex Starter Stubs"</span></a></p>
The post <a href="https://nerdpress.org/2011/11/04/silex-starter-stubs/">Silex Starter Stubs</a> first appeared on <a href="https://nerdpress.org">Nerdpress.org</a>.]]></description>
										<content:encoded><![CDATA[<p>There are several preconfigured <a href="http://silex.sensiolabs.org/">Silex</a> Apps on github. They let you start your Silex project in no time, which is good.<br />
This makes Silex an even more simple rabbithole into the symfony2 world.</p>
<p>I started one myself and had a close look on the others, so i thought i share this.<br />
They all differ a bit so you must choose what fits your needs the best.</p>
<p>They all follow some kind of &#8220;best practise&#8221; structure, some more, some less.</p>
<p><span id="more-1924"></span></p>
<p>So there is: <a href="https://github.com/gcalore/Silex-Stub">https://github.com/gcalore/Silex-Stub</a><br />
This has several common Providers already enabled:</p>
<ul>
<li>Twig</li>
<li>UrlGenerator</li>
<li>Monolog</li>
<li>Doctrine DBAL</li>
<li>Validator</li>
<li>Forms</li>
</ul>
<p>but it has no Frontend Frameworks integrated.<br />
Another minus point is that the index is not in a web directory but in root, so that all lib files etc. are potentially accessible from the web, thou a .htaccess avoids that here.<br />
It also doesnt provide tests.<br />
So i wouldnt recommend that one.</p>
<p>The next one is: <a href="https://github.com/brtriver/silex-sample-application">https://github.com/brtriver/silex-sample-application</a><br />
This is a sample rudimentary blog application that you could use as starter.<br />
It has Doctrine and Twig build-in, it has tests but also doesnt include some frontend magic.</p>
<p>The most complete is: <a href="https://github.com/lyrixx/Silex-Kitchen-Edition">https://github.com/lyrixx/Silex-Kitchen-Edition</a><br />
This starterkit has several extension enabled:</p>
<ul>
<li>Doctrine</li>
<li>Form</li>
<li>Session</li>
<li>SymfonyBrige</li>
<li>Translation</li>
<li>Twig (with debug extension)</li>
<li>UrlGenerator</li>
</ul>
<p>and it also has the HTML5Boilerplate and Twitter`s Bootstrap integrated.<br />
Further <em>Assetic</em> and the <em>YAMLLoader</em> are already shipped and active and tests are provided aswell.<br />
Here Silex is included as submodule, which means unpacked &#8211; hence not as phar-, which might be interesting for some.<br />
In my Opinion this is some kind of a reference app, this is even more likely since the creator is sensio employee.<br />
I stole a lot from it ;).</p>
<p>Last but not least mine ;) : <a href="https://github.com/ivoba/superleansilexplate">https://github.com/ivoba/superleansilexplate</a><br />
Its supposed to be very lean.<br />
It comes just with <em>Twig</em> and <em>Translation</em> enabled.<br />
It aims mainly at simple applications that need routing and just some additional logic. F.e. its a good container for javascript driven apps that get their data through API calls. If you need database support and more, simply register the provider yourself or use the <a href="https://github.com/lyrixx/Silex-Kitchen-Edition">kitchen</a>.</p>
<p>Tests are included and for the frontend there is the a mix of skeleton(bootstrap seemed too verbose and too twitter branded for mi gusto) and HTML5boilerplate.<br />
Also there is an optimized Boilerplate Build included to avoid Assetic.</p>
<p><a href="https://nerdpress.org/wp-content/uploads/2011/11/superleansilexplate.png"><img decoding="async" class="alignnone size-medium wp-image-1939" title="superleansilexplate" src="https://nerdpress.org/wp-content/uploads/2011/11/superleansilexplate-300x148.png" alt="" width="300" height="148" srcset="https://nerdpress.org/wp-content/uploads/2011/11/superleansilexplate-300x148.png 300w, https://nerdpress.org/wp-content/uploads/2011/11/superleansilexplate.png 972w" sizes="(max-width: 300px) 100vw, 300px" /></a><br />
Its not really finished yet, but sufficient to start with.<br />
(feel free to provide some improvements)</p>The post <a href="https://nerdpress.org/2011/11/04/silex-starter-stubs/">Silex Starter Stubs</a> first appeared on <a href="https://nerdpress.org">Nerdpress.org</a>.]]></content:encoded>
					
					<wfw:commentRss>https://nerdpress.org/2011/11/04/silex-starter-stubs/feed/</wfw:commentRss>
			<slash:comments>2</slash:comments>
		
		
			</item>
	</channel>
</rss>
