https://github.com/morning-train/laravel-deployment
A package to parse a file for version/deployment information.
https://github.com/morning-train/laravel-deployment
laravel laravel-package
Last synced: about 1 year ago
JSON representation
A package to parse a file for version/deployment information.
- Host: GitHub
- URL: https://github.com/morning-train/laravel-deployment
- Owner: Morning-Train
- License: mit
- Created: 2022-06-02T11:33:07.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2022-06-02T13:29:32.000Z (about 4 years ago)
- Last Synced: 2025-04-03T15:43:58.249Z (about 1 year ago)
- Topics: laravel, laravel-package
- Language: PHP
- Homepage:
- Size: 21.5 KB
- Stars: 2
- Watchers: 3
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Deployment
[](https://packagist.org/packages/morningtrain/laravel-deployment)
[](https://github.com/Morning-Train/laravel-deployment/actions?query=workflow%3Arun-tests+branch%3Amain)
[](https://github.com/Morning-Train/laravel-deployment/actions?query=workflow%3A"Check+%26+fix+styling"+branch%3Amain)
[](https://packagist.org/packages/morningtrain/laravel-deployment)
A package to parse a file for version/deployment information.
## Installation
You can install the package via composer:
```bash
composer require morningtrain/laravel-deployment
```
You can publish the config file with:
```bash
php artisan vendor:publish --tag="deployment-config"
```
This is the contents of the published config file:
```php
return [
/*
|--------------------------------------------------------------------------
| Deployment JSON File
|--------------------------------------------------------------------------
|
| This value is the path to your JSON file. This value is used by the deployment
| parser to know which JSON file to parse and look for deployment information,
| to use in your application or provide services like Bugsnag or CI/CD.
|
*/
'file' => env('DEPLOYMENT_JSON_FILE_PATH'),
];
```
## Deployment.json file
The `deployment.json` we use, looks like this
```json
{
"revision": "123456789",
"version": "v1.4.0",
"repository": "http://url-to.repository",
"username": "User Name"
}
```
The package expects the file to match the format, to be able to parse it.
## Usage
Get the version number
```php
use Morningtrain\Deployment\Facades\Deployment;
Deployment::version();
```
Get the username of the committer
```php
Deployment::username();
```
Get the revision of the commit
```php
Deployment::revision();
```
Get the repository URL
```php
Deployment::repository();
```
Get all the data in a Version object
```php
Deployment::get();
```
## Testing
```bash
composer test
```
## Changelog
Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.
## Credits
- [Peter Brinck](https://github.com/peterbrinck)
- [All Contributors](../../contributors)
## License
The MIT License (MIT). Please see [License File](LICENSE.md) for more information.