<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/"><channel><title>PSR-4 on Mike Bell - Blog &amp; Stuff</title><link>https://mikebell.io/tags/psr-4/</link><description>Recent content in PSR-4 on Mike Bell - Blog &amp; Stuff</description><generator>Hugo -- gohugo.io</generator><language>en</language><managingEditor>hello@mikebell.io (Mike Bell)</managingEditor><webMaster>hello@mikebell.io (Mike Bell)</webMaster><copyright>© 2026 Mike Bell</copyright><lastBuildDate>Sun, 01 Jun 2014 00:00:00 +0000</lastBuildDate><atom:link href="https://mikebell.io/tags/psr-4/index.xml" rel="self" type="application/rss+xml"/><item><title>PSR-4 for dummies with practical example</title><link>https://mikebell.io/posts/psr-4-for-dummies/</link><pubDate>Sun, 01 Jun 2014 00:00:00 +0000</pubDate><author>hello@mikebell.io (Mike Bell)</author><guid>https://mikebell.io/posts/psr-4-for-dummies/</guid><description>
&lt;p>Every time I come to write a new application I always forget how to use PSR-4 so here’s my practical example&lt;/p>
&lt;p>Directories:&lt;/p>
&lt;pre>&lt;code>- src
- - Digital
- - - Epok
- - - - Controller
- - - - - HomePageController.php
&lt;/code>&lt;/pre>
&lt;p>composer.json&lt;/p>
&lt;pre>&lt;code>{
&amp;quot;require&amp;quot;: {
&amp;quot;silex/silex&amp;quot;: &amp;quot;~1.1&amp;quot;
},
&amp;quot;autoload&amp;quot;: {
&amp;quot;psr-4&amp;quot;: {
&amp;quot;Digital\\Epok\\Controller\\&amp;quot;: &amp;quot;src/Digital/Epok/Controller&amp;quot;
}
}
}
&lt;/code>&lt;/pre>
&lt;p>HomePageController.php&lt;/p>
&lt;pre>&lt;code>&amp;lt;?php
namespace Digital\Epok\Controller;
use Silex\Application;
use Symfony\Component\HttpFoundation\Request;
class HomePageController {
public function homePage(Request $request, Application $application) {
return 'Hi';
}
}
&lt;/code>&lt;/pre>
&lt;p>Hopefully this will help me remember how I should setup PSR-4 with a new project.&lt;/p>
&lt;p>Thanks for reading via RSS!&lt;/p>
&lt;p>Send me a message on &lt;a href="https://remotelab.uk/mikebell">Mastodon&lt;/a> or &lt;a href="mailto:hello@mikebell.io">email me&lt;/a>&lt;/p></description></item></channel></rss>