Skip to content
Set and retrieve the date and time when the last deployment of your Laravel-app occurred.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src
tests
.gitignore
.travis.yml
LICENSE.md
composer.json
phpunit.xml
readme.md

readme.md

Deploy

Latest Version on Packagist Software License Build Status

A simple Laravel-package to write a deploy file to your storage path. This file can then be used to check when the last deploy occurred. Useful for both debugging purposes and if you need to keep track of builds, updates etc.

Installation

$ composer require "olssonm/deploy:^1.0"

Only tested for Laravel >= 5.5 but should work with any version of Laravel higher than 5.1. This package does require PHP >= 7.0 however.

The package will be auto-discovered in Laravel >= 5.5, else you can add it to your providers array (config/app.php):

'providers' => [
    Olssonm\Deploy\ServiceProvider::class
]

Usage

olssonm\deploy comes with a set of Artisan-command that you can use straight out of the box:

deploy:make

$ php artisan deploy:make
// Deployed @ 2017-12-02 09:22:11

Writes the deployment-file for inspection and timekeeping. Per default the file is located in your storagepath/app/deploy.txt.

deploy:when

$ php artisan deploy:when
// Last deploy occurred @ 2017-12-02 09:22:11

Displays the time and date of the last deploy.

In app

You can also use the Olssonm\Deploy\Deploy-class for other more custom functions.

use Olssonm\Deploy\Deploy;

$deploy = new \Olssonm\Deploy\Deploy();
$deploy->make(); // Writes "now" as the deployment time
$deploy->when(); // Retrieves the last deployment time as a Carbon-instance

The class is also available for dependency injection:

use Olssonm\Deploy\Deploy;

public function when(Deploy $deploy)
{
    return $deploy->when();
}

Or via the facade (register Olssonm\Deploy\Facades\Deploy::class in your aliases-array) or app singleton;

app('deploy')->when()->format('Y-m-d'); // App singleton
Deploy::when()->format('Y-m-d'); // Via an alias

Pro tip: if you are using a custom deploy routine where you run composer install you can add php artisan deploy:make to your list of post-install-cmd-commands to automatically fire the command:

"scripts": {
    "post-install-cmd": [
        "php artisan deploy:make"
    ]
}

Testing

$ composer test

or

$ phpunit

License

The MIT License (MIT). Please see License File for more information.

© 2018 Marcus Olsson.

You can’t perform that action at this time.