Using devenv with laravel
DevEnv is another amazing tool coming from the nix community that allows you to define a full dev environment including:
- language support
- tasks
- processes
There's a little thing I found though: You have to add .devenv and .direnv to be ignored by vite's watcher or your app will crawl
server: {
cors: true,
watch: {
ignored: [
'**/storage/framework/views/**',
'**/.devenv/**',
'**/.direnv/**'
],
},
},
The devenv setup
In your devenv.nix
{
pkgs,
lib,
config,
inputs,
...
}:
{
packages = with pkgs; [
frankenphp
];
languages.php.enable = true;
languages.javascript = {
enable = true;
# Optional
bun = {
enable = true;
install.enable = true;
};
};
processes = {
server = {
exec = "frankenphp php-server --listen :8000 --root public/";
};
frontend_build = {
exec = "bun run dev";
};
};
services.postgres = {
enable = true;
listen_addresses = "127.0.0.1";
port = 5432;
initialDatabases = [
{
name = "betterhelp";
user = "laravel";
pass = "password";
}
];
};
}
After that, simply doing devenv up or devenv up -d (to start the processes in the background) will put up
- Postgres
- The app server
- The vite watcher process to compile front end assets
Use Packages Because You Want To. Not Because You Have To.
It's increasingly popular in today's development landscape to solve every problem you have, no matter how minute, by installing a package. Projects with 1k+ npm dependencies are the norm. Quite frankly, this approach just highlights the skill issues with today's developers. Especially javascript devs.
Why Livewire is great for Solo Laravel Developers
I've gone through all the stages of Laravel in the recent years. From plain blade with Jquery, to sprinkling VueJs, to full InertiaJS apps, and now I've landed on livewire. In this short post I'll tell you why I think livewire is the best option for solo developers that just want to get something done.