Sevalla is the all-in-one PaaS for your web projects. Host and deploy your applications, databases, object storage, and static sites. Enjoy advanced deployment pipelines, a complete database studio, instant preview apps, and one-click templates. The pricing is simple: no hidden fees, no seat-based pricing, and you pay only for what you use. Get real human support from developers.

Get started now with a $50 credit at Sevalla.com.

Add .env support to Laravel 4

Link –

It's very easy to port Laravel 5's way of handling environment files to Laravel 4.

You've got to require this package (it's that one that L5 uses): [code]composer require vlucas/phpdotenv```

And then you should update bootstrap/start.php:


...
$dotEnv = new Dotenv\Dotenv(__DIR__ . '/../');
$dotEnv->load();

$env = $app->detectEnvironment(function () {
    return getenv('APP_ENV') ?: 'production';
});
...

And boom, done! Now you can use an .env-file instead of .env.php.

Read more

Copywriting is interface design

Link –

Thomas Byttebier wrote down some of his thoughts on copywriting.

... copywriting is an often overlooked aspect of UI design. That’s a serious shortcoming, because if you come to think of it: most of an app’s user interface simply is text. Hide the icons, imagery or colors and every app or web site is basically just letters and numbers. There may be some data in there, a significant part of it is UI. It would be stupid not to take excellent care of it.
http://thomasbyttebier.be/blog/copywriting-is-interface-design

Be sure to also check out his posts on icons and typography.

Read more

Stay up to date with all things Laravel, PHP, and JavaScript.

You can follow me on these platforms:

On all these platforms, regularly share programming tips, and what I myself have learned in ongoing projects.

Every month I send out a newsletter containing lots of interesting stuff for the modern PHP developer.

Expect quick tips & tricks, interesting tutorials, opinions and packages. Because I work with Laravel every day there is an emphasis on that framework.

Rest assured that I will only use your email address to send you the newsletter and will not use it for any other purposes.

Voodoo PHP

Link –

If you're interested in some dark magic you should watch this talk by Marco Pivetta on Voodoo PHP. I really like these show-me-the-code type of talks.

We've often seen "magic" code, but how does it even work? Let's explore some arguably bad PHP coding techniques that are actually used in real world libraries to solve problems that would otherwise be a huge burden for all of us.

Read more

The first PHP Antwerp meetup

Original – by Freek Van der Herten – 1 minute read

Earlier tonight the first PHP Antwerp meetup was held. The event was organised by Dries Vints of BeatSwich. I was the first speaker and talked a little bit about Satis and how we use it at Spatie. You can view the slides on Speakerdeck. The big talk of the evening was delivered by Mitchell van…

Read more

Git from the inside out

Link –

This essay explains how Git works. It assumes you understand Git well enough to use it to version control your projects.

The essay focuses on the graph structure that underpins Git and the way the properties of this graph dictate Git’s behavior. Looking at fundamentals, you build your mental model on the truth rather than on hypotheses constructed from evidence gathered while experimenting with the API. This truer model gives you a better understanding of what Git has done, what it is doing, and what it will do.

https://codewords.recurse.com/issues/two/git-from-the-inside-out

Read more

Extract till your drop

Link –

Watch a very instructive live coding session with Matthias Verraes.

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 session, I will demonstrate how you can start refactoring your way out of a mess today.

Read more

Recursion and Generators

Link –

Christopher Pitt experimented a bit with generators and wrote down the thought process on his blog.

Generators are awesome. If they’re new to you then take some time to read where they come from and what they do. If you’ve come from a particular programming language background, they may be difficult for you to understand.

They were, and continue to be, tricky for me to grasp. So I’ve spent loads of time trying to understand them, and what they can do for my code.

https://medium.com/@assertchris/recursion-and-generators-d56f513ea6ab

Read more

The case for maintainable code

Link –

Developers and their employers are often at odds over matters like clean or beautiful code and with good reason: neither ships a product or increases sales. Most end users don’t care what the code looks like, as long as the product works and meets their needs. That means that beautiful code goes out the window when the rubber meets the road and crunch time sets in.

The fact of the matter is that framing code discussions in terms of beauty or attractiveness doesn’t help the case for getting code that’s clean. But there’s another way to frame the discussion that makes more sense, and achieves both the goal of writing clean code and meets the needs of most businesses: the concept of maintainable code.

http://www.brandonsavage.net/the-case-for-maintainable-code/

Read more

Aspect Oriented PHP And The Interceptor Pattern

Link –

There are many ways to modify the behavior of existing code with actually changing the core logic. Some patterns you might be familiar with are the decorator pattern or the observer pattern. Both allow you to take another object and modify the behavior by wrapping your modifications around the original code. One pattern you might not be familiar with though, is the interceptor pattern.

The interceptor pattern is a core concept of what is called aspect oriented programming (AOP). AOP aims to improve the modularity of your code by allowing you to separate cross-cutting concerns from the rest of your code.

http://www.edzynda.com/aspect-oriented-php-and-the-interceptor-pattern/

Read more

A trait to optionally abort a Laravel app

Original – by Freek Van der Herten – 1 minute read

Inspired by Edd Man's post on optional value control-flows I made a small Laravel package to optionally abort your application. The package provides a Spatie\OrAbort\OrAbort-trait that can be used on any class you want. All the methods of the class will gain orAbort-variant. When the original…

Read more

Optional Value Control-flows in PHP using Traits and Magic-methods

Link –

Edd Mann demonstrates a nice trait to add OrElse functionality to a class via a trait. With it you can do things like:

[code]

$cart = $repository->findByIdOrElse(1, new ShoppingCart); $cart = $repository->findByIdOrElse(1, function () { return new ShoppingCart; });



<a href="http://tech.mybuilder.com/optional-value-control-flows-in-php-using-traits-and-magic-methods/">http://tech.mybuilder.com/optional-value-control-flows-in-php-using-traits-and-magic-methods/</a>

Read more