Previously, I wrote laravel-auditor to automatically manage events in Laravel to allow developers to easily create an audit log (see it here).

Now, I wanted to automate the update process for a deployment. We ain't fancy, we use Git but no CI/CDs for small projects, so I figured a PHP package would do the trick.

Say hello to laravel-updater.

What is this hackery?

Yes, it admittedly is a quick hack.

It doesn't compare to the big pipelines and CI/CDs a typical workflow would have. But you'd be surprised at the amount of teams that aren't so familiar with automated tests and continuous integrations, so I built this as a stop-gap solution for my team of juniors, and for some minor projects I work on at the side.

Basically, it exposes a route that can receive POST requests. This way, you can set this up at GitLab or GitHub (or basically any webhook-compatible service) and throw a request to run a command over the internet.

All you need is Laravel 7 and PHP 7.2 and above. Then, run:

composer require demafelix/laravel-updater

After installing the package, publish the configuration file:

php artisan vendor:publish --tag=config

Then, fiddle around with the configuration file and you should be good to go.

By the way, it also integrates nicely with Slack using a webhook:

It'll show you if a queued update has finished successfully or failed.

It uses Laravel's queues in the backend, so it doesn't have to wait for a response. It still does when QUEUE_CONNECTION is set to sync, but do yourself a favor and use better queue management systems.

To integrate with Slack, simply create a webhook and specify the URL in the .env as SLACK_HOOK_URL.

To learn more or view the source code, visit the repository on GitHub.