Tangible Bytes

A Web Developer’s Blog

Kubernetes Multi Container Pod

So far on my Kubernetes journey I’ve only ever had one container per pod.

But I needed to run php-fpm fronted by nginx - with static assets served direct by nginx.

A lot of online examples skip this complexity by serving both php and static assets via Apache.

While it seemed complex at first - like a lot of Kubernetes it’s fairly straightforward once you have made the leap.

Read more ...

Security Hardening Php

Most of what you read about securing PHP is how to write secure code - and that is really important.

In addition it helps to setup PHP on the server for best security.

There is plenty we can do to harden the setup without hurting the functionality we need.

The more layers we have in our security setup the better.

Read more ...

PHP Docker for Dev

I’m staring a new PHP project and I wanted a clean docker image to work from.

I inherited one on my last project and wanted to improve image size, security and production alignment.

Read more ...

Laravel Route Binding Null/Empty Object

Laravel’s routing and binding is nice

But when I got it wrong I didn’t get the kind of error I expected

Laravel automatically resolves Eloquent models defined in routes or controller actions whose type-hinted variable names match a route segment name.

use App\Models\User;
 
Route::get('/users/{user}', function (User $user) {
    return $user->email;
});
Read more ...