10 Reasons To Use HTTPS

Today, however, there are more reasons than ever to switch to HTTPS — even for a news site, corporate site, or any site that doesn’t consider itself at the top of the security food chain. HTTPS adoption grew 80% last year alone, much faster than previous years, but we’re still very far from encryption being the norm.

If you’re not convinced HTTPS is right for you, or need ammo to convince your peers and bosses, here are 10 good reasons to go HTTPS.

https://medium.com/@guypod/10-reasons-to-go-https-a2cba5734bb6

Read more

How to contribute to PHP documentation

Sammy Kaye Powers wrote a post on how to contribute to the PHP documentation.

If you've been wanting to contribute to PHP internals, starting with the documentation can be a great entry point; especially because it doesn't require dusting off those old C books from college.

But knowing where to start can be tricky since information on how to contribute to the docs is scattered across the internet.

Phew! After reading this process my intentions of contributing melted away like snow in the sun. Editing the documentation should be much easier. I believe there would be more contributions if the docs would reside in a git-repo as markdown-files.

Read more

Join 9,500+ smart developers

Get my monthly newsletter with what I learn from running Spatie, building Oh Dear, and maintaining 300+ open source packages. Practical takes on Laravel, PHP, and AI that you can actually use.

No spam. Unsubscribe anytime. You can also follow me on X.

Convert a pdf to an image using PHP original

by Freek Van der Herten – 1 minute read

Converting a pdf to an image is easy using PHP, but the API kinda sucks. $imagick = new Imagick('file.pdf[0]'); $imagick->setImageFormat('jpg'); file_put_contents($pathToImage, $imagick); The pdf-to-image-package aims to fix that. Here is the equivalent code: $pdf = new…

Read more

A new version of the medialibrary package original

by Freek Van der Herten – 1 minute read

When starting out with Laravel I made a medialibrary to associate uploaded files with models. In our custom made cms we use the medialibrary to for example associate articles with images. In short the medialibrary could: associate files with models generate thumbnails and other derived images from…

Read more

In favor of the singleton

A short and very enjoyable read by Uncle Bob on singletons:

Do you recognize this: ``` public class X { private static X instance = null;

private X() {}

public static X instance() { if (instance == null) instance = new X(); return instance; }

// more methods... }


<em>Of course. That's the Singleton pattern from the GOF book. I've always heard we shouldn't use it.</em>

Why shouldn't we use it?

<em>Because it makes our systems hard to test.</em>

It does? Why is that?

....</blockquote>
You can read the whole conversation on <a href="http://blog.cleancoder.com/uncle-bob/2015/07/01/TheLittleSingleton.html">http://blog.cleancoder.com/uncle-bob/2015/07/01/TheLittleSingleton.html</a>

Read more

Add .env support to Laravel 4

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

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

Voodoo PHP

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

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

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

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