PHP code example of pragmarx / version

1. Go to this page and download the library: Download pragmarx/version library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

pragmarx / version example snippets

 bash
php artisan version:commit
 bash
$ php artisan version:major   
$ php artisan version:minor   
$ php artisan version:patch   
$ php artisan version:build   
 php
Version::compact()
 php
Version::awesome()
 php
dd(
    Version::format()
);
 php
$version = new \PragmaRX\Version\Package\Version();

dd(
    $version->format()
);
 php
dd(
    app(\PragmaRX\Version\Package\Version::class)->format()
);
 php
@version
 php
@version('full')
@version('compact')
 php
@printversion('compact')



namespace App\Exceptions;

use PragmaRX\Version\Package\Version;
use Bugsnag\BugsnagLaravel\Facades\Bugsnag;

class Handler extends ExceptionHandler
{
    public function report(Exception $exception)
    {
        if ($this->shouldReport($exception)) {
            Bugsnag::setAppVersion((new Version())->format('version'));
            Bugsnag::notifyException($exception);
        }
    }
}

php artisan version:timestamp
 text
$ php artisan version:minor
New timestamp: 2019-09-16 18:23:03
MyApp version 2.3.2 (commit 49ffe2)
 bash
$ php artisan version:absorb
 text
$ php artisan version:minor
New minor version: 5
MyApp version 1.5.0 (commit 701045)
 bash
$ php artisan vendor:publish --provider="PragmaRX\Version\Package\ServiceProvider"
 php
@version
 json
"post-autoload-dump": [
    ...
    "@php artisan version:refresh"
]
 bash
#!/bin/sh

php artisan version:refresh