<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Sylvain PHILIP</title>
    <description>The latest articles on Forem by Sylvain PHILIP (@ilhooq).</description>
    <link>https://forem.com/ilhooq</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F720564%2F8bc484eb-e2f8-4012-af69-d4364d6b8f20.jpeg</url>
      <title>Forem: Sylvain PHILIP</title>
      <link>https://forem.com/ilhooq</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/ilhooq"/>
    <language>en</language>
    <item>
      <title>Piko Framework overview</title>
      <dc:creator>Sylvain PHILIP</dc:creator>
      <pubDate>Wed, 16 Nov 2022 08:43:49 +0000</pubDate>
      <link>https://forem.com/ilhooq/piko-framework-overview-29f1</link>
      <guid>https://forem.com/ilhooq/piko-framework-overview-29f1</guid>
      <description>&lt;p&gt;Today I would like to make a presentation on the Piko, a new one in the PHP frameworks landscape.&lt;/p&gt;

&lt;p&gt;Piko is a lightweight, fast and flexible PHP micro framework. It is easy to learn and use, and probably making it a great choice for web development.&lt;/p&gt;

&lt;h2&gt;
  
  
  Genesis
&lt;/h2&gt;

&lt;p&gt;I'm the author of Piko and the project started in 2019. My primary idea was to embed a micro-framework library with a small footprint in a distributed application and working like Yii2 framework but keeping only the essential to build a Web application.&lt;/p&gt;

&lt;p&gt;With this idea in mind, I decided to write the library and given its name "Piko", an assembly of "Pico" and "Peak" in one word. "Pico" for lightness and "Peak" for precision.&lt;/p&gt;

&lt;h2&gt;
  
  
  Features
&lt;/h2&gt;

&lt;p&gt;In the actual state, Piko comes with:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A middleware interface&lt;/li&gt;
&lt;li&gt;A blazing fast &lt;a href="https://dev.to/ilhooq/piko-router-a-lightweight-and-blazing-fast-router-for-php-5cb9"&gt;router&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;A modular MVC routing&lt;/li&gt;
&lt;li&gt;A simple rendering engine (using PHP templates)&lt;/li&gt;
&lt;li&gt;An event handler&lt;/li&gt;
&lt;li&gt;A model helper&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Additional features (in separate packages):&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A i18n component &lt;/li&gt;
&lt;li&gt;An Active Record component&lt;/li&gt;
&lt;li&gt;A user session component&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Each of these components has been well tested.&lt;/p&gt;

&lt;p&gt;Moreover, Piko is compliant with good practices and PHP standards. It works well with third-party libraries that follow these standards too.&lt;/p&gt;

&lt;h2&gt;
  
  
  Demo
&lt;/h2&gt;

&lt;p&gt;To have a look on a basic application made with Piko, you can scaffold a project on the command line using composer:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;composer create-project piko/project yourproject
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then you can launch the project using the built-in PHP web server:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;cd &lt;/span&gt;yourproject
php &lt;span class="nt"&gt;-S&lt;/span&gt; localhost:8080 &lt;span class="nt"&gt;-t&lt;/span&gt; web
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Real use cases
&lt;/h2&gt;

&lt;p&gt;These websites were built with Piko:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://www.posterfortomorrow.org/"&gt;www.posterfortomorrow.org&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.3dminfographie.com/en/"&gt;www.3dminfographie.com&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.sphilip.com/"&gt;www.sphilip.com&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  More info
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://piko-framework.github.io/"&gt;Documentation&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/piko-framework/piko"&gt;Source repo&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>php</category>
      <category>mvc</category>
    </item>
    <item>
      <title>Piko router, a lightweight and blazing fast router for PHP</title>
      <dc:creator>Sylvain PHILIP</dc:creator>
      <pubDate>Thu, 07 Oct 2021 12:02:04 +0000</pubDate>
      <link>https://forem.com/ilhooq/piko-router-a-lightweight-and-blazing-fast-router-for-php-5cb9</link>
      <guid>https://forem.com/ilhooq/piko-router-a-lightweight-and-blazing-fast-router-for-php-5cb9</guid>
      <description>&lt;p&gt;I recently wrote a new PHP router (&lt;a href="https://github.com/piko-framework/router"&gt;Piko router&lt;/a&gt;) that stick out from the others by its implementation.&lt;/p&gt;

&lt;p&gt;Unlike popular PHP routers, Piko router doesn't solve the problem of route matching using &lt;a href="https://www.npopov.com/2014/02/18/Fast-request-routing-using-regular-expressions.html"&gt;regular expressions&lt;/a&gt;. Instead of that, it uses a &lt;a href="https://en.wikipedia.org/wiki/Radix_tree"&gt;radix trie&lt;/a&gt; structure to store routes definitions and a search algorithm to retrieve them against a given path. This approach is very efficient because the search consist just to traverse a prefix tree. &lt;/p&gt;

&lt;p&gt;I found libraries in other programming languages that use this approach : &lt;a href="https://github.com/ibraheemdev/matchit/"&gt;matchit&lt;/a&gt; (Rust), &lt;a href="https://github.com/delvedor/find-my-way"&gt;find-my-way&lt;/a&gt; (Javascript), &lt;a href="https://github.com/fasthttp/router"&gt;fasthttp&lt;/a&gt; (Go) But, curiously, no one in PHP. That's why I decided to bring my contribution to have the same approach in PHP.&lt;/p&gt;

&lt;p&gt;To demonstrate this search efficiency, I wrote some &lt;a href="https://github.com/piko-framework/router#benchmarks"&gt;benchmark tests&lt;/a&gt; to compare Piko router against &lt;a href="https://github.com/nikic/FastRoute"&gt;Fastroute&lt;/a&gt; and &lt;a href="https://github.com/symfony/routing"&gt;Symfony Router&lt;/a&gt; which are references in their domain.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--OMn4cuQ9--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/46o002hifiu2zfww1tz9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--OMn4cuQ9--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/46o002hifiu2zfww1tz9.png" alt="Routers benchmark over 5000 routes"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Piko router was initially designed to be used in the Piko framework (another project I made) but it can be embedded as a standalone dependency in third party application via &lt;a href="https://packagist.org/packages/piko/router"&gt;composer&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>php</category>
      <category>webdev</category>
      <category>algorithms</category>
    </item>
  </channel>
</rss>
