Carbon – A simple PHP API extension for DateTime.

$carbon = new Carbon(‘first day of next week’); if ($carbon->isWeekend()) { echo ‘Party!’; } echo $carbon->addYear()->diffForHumans(); // ‘in 1 year’ Carbon is just a class which is designed to be used instead of DateTime. Due to extending DateTime, all DateTime methods are available to users of Carbon. Additionally, it implements a __toString method, allowing users …

Sublime Text 3 for PHP Developers

I admit, I’m a Sublime Text user. Why? Because it’s an IDE that plays nice for a lot of languages. Using Sublime Text I can let my students – from the first year up until the third – write SQL statements, HTML, JS, PHP, etc. in it all without needing to learn to work a …

Extract Till You Drop

Under the pressure of deadlines and endless change requests, under the weight of years of legacy, code becomes unmaintainable. With the right tools, techniques, and mindset, any codebase can be brought under test, and be refactored towards a better architecture. Let’s skip the theory and dive straight into the spaghetti code. In a live coding …

StackPHP – HttpKernelInterface based middlewares

The HttpKernelInterface models web request and response as PHP objects, giving them value semantics. Stack is a convention for composing HttpKernelInterface middlewares. By wrapping your application in decorators you can add new behaviour from the outside. In the screenshot above Session is a decorator wrapped around Authentication which itself is a decorator wrapped around the …

Recommended Reading: Modern PHP

PHP is experiencing a renaissance, though it may be difficult to tell with all of the outdated PHP tutorials online. With this practical guide, you’ll learn how PHP has become a full-featured, mature language with object-orientation, namespaces, and a growing collection of reusable component libraries. Author Josh Lockhart—creator of PHP The Right Way, a popular …

PHP Scalar Type Hints, Follow-up

The vote for the RFC “PHP Scalar Type Hints” got cancelled, after the author of the RFC – Andrea Faulds – posted “I Quit” on the internals list: For my own reasons, I have decided to cease my involvement with PHP development. […] I’m no longer contributing to PHP, and all four active RFCs authored …