Tangible Bytes

A Web Developer’s Blog

Laravel Frankenphp Octane Sail

My Laravel project is in part a headless CMS - this means it has and API that gets called by a frontend system - with around 10 API requests per page view.

We can cache some of that - but sometimes caches are empty and the site still has to be responsive.

The meant I needed to optimise my Laravel site and after a few experiments I found that using [Laravel Octane]](https://laravel.com/docs/12.x/octane) with FrankenPHP gave me the performance boost I needed without needing any significant code change.

Read more ...

Laravel Vite Wont Serve Build Files

This is a silly one.

I wanted to run Laravel in dev mode but using the compiled js and scss from npm run build via vitejs.

This usually works

but for some reason Laravel was trying to serve js/css from http://localhost:5173/@vite/client

a service I usually run - but I wanted to test the build stuff.

The solution is really simple but not well documented.

Read more ...

Multiple Authentication in Laravel

You may not need this, if you can manage multiple types of user via roles and permissions it will be much the simpler route to follow.

In my case I wanted user with different: properties, relationships, routes, password rules, timeouts, and more.

It was worth the pain of setting up two authenticatable models.

Laravel is very flexible and well documented, but the further you stray from what most people do - the less obvious it is and a few of these steps took me a while to figure out.

Read more ...