├── .editorconfig ├── .gitattributes ├── .gitignore ├── .styleci.yml ├── LICENSE.md ├── README.md ├── composer.json └── src ├── Config └── version.php ├── Facade.php ├── Provider.php ├── Version.php └── helpers.php /.editorconfig: -------------------------------------------------------------------------------- 1 | ; This file is for unifying the coding style for different editors and IDEs. 2 | ; More information at https://editorconfig.org 3 | 4 | root = true 5 | 6 | [*] 7 | charset = utf-8 8 | indent_size = 4 9 | indent_style = space 10 | end_of_line = lf 11 | insert_final_newline = true 12 | trim_trailing_whitespace = true 13 | 14 | [*.md] 15 | trim_trailing_whitespace = false 16 | 17 | [*.yml] 18 | indent_size = 2 -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # Set the default behavior, in case people don't have core.autocrlf set. 2 | * text eol=lf 3 | 4 | # Explicitly declare text files you want to always be normalized and converted 5 | # to native line endings on checkout. 6 | *.c text 7 | *.h text 8 | 9 | # Declare files that will always have CRLF line endings on checkout. 10 | *.sln text eol=crlf 11 | 12 | # Denote all files that are truly binary and should not be modified. 13 | *.png binary 14 | *.jpg binary 15 | *.otf binary 16 | *.eot binary 17 | *.svg binary 18 | *.ttf binary 19 | *.woff binary 20 | *.woff2 binary 21 | 22 | *.css linguist-vendored 23 | *.scss linguist-vendored 24 | *.js linguist-vendored 25 | CHANGELOG.md export-ignore 26 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /vendor 2 | composer.phar 3 | composer.lock 4 | .DS_Store -------------------------------------------------------------------------------- /.styleci.yml: -------------------------------------------------------------------------------- 1 | preset: psr2 2 | 3 | enabled: 4 | - concat_with_spaces -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2017 Akaunting 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Version management package for Laravel 2 | 3 | [![Downloads](https://poser.pugx.org/akaunting/laravel-version/d/total.svg)](https://github.com/akaunting/laravel-version) 4 | [![StyleCI](https://styleci.io/repos/101269981/shield?style=flat&branch=master)](https://styleci.io/repos/101269981) 5 | [![License](https://poser.pugx.org/akaunting/laravel-version/license.svg)](LICENSE.md) 6 | 7 | This is a [SemVer](http://semver.org) compatible version management package for any software built on Laravel. 8 | 9 | ## Getting Started 10 | 11 | ### 1. Install 12 | 13 | Run the following command: 14 | 15 | ```bash 16 | composer require akaunting/laravel-version 17 | ``` 18 | 19 | ### 2. Register (for Laravel < 5.5) 20 | 21 | Register the service provider in `config/app.php` 22 | 23 | ```php 24 | Akaunting\Version\Provider::class, 25 | ``` 26 | 27 | Add alias if you want to use the facade. 28 | 29 | ```php 30 | 'Version' => Akaunting\Version\Facade::class, 31 | ``` 32 | 33 | ### 3. Publish 34 | 35 | Publish config file. 36 | 37 | ```bash 38 | php artisan vendor:publish --tag=version 39 | ``` 40 | 41 | 42 | ### 4. Configure 43 | 44 | You can change the version information of your app from `config/version.php` file 45 | 46 | ## Usage 47 | 48 | ### version($method = null) 49 | 50 | You can either enter the method like `version('short')` or leave it empty so you could firstly get the instance then call the methods like `version()->short()` 51 | 52 | ## Changelog 53 | 54 | Please see [Releases](../../releases) for more information what has changed recently. 55 | 56 | ## Contributing 57 | 58 | Pull requests are more than welcome. You must follow the PSR coding standards. 59 | 60 | ## Security 61 | 62 | If you discover any security related issues, please email security@akaunting.com instead of using the issue tracker. 63 | 64 | ## Credits 65 | 66 | - [Denis Duliçi](https://github.com/denisdulici) 67 | - [All Contributors](../../contributors) 68 | 69 | ## License 70 | 71 | The MIT License (MIT). Please see [LICENSE](LICENSE.md) for more information. 72 | -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "akaunting/laravel-version", 3 | "description": "Version management package for Laravel", 4 | "keywords": [ 5 | "laravel", 6 | "version" 7 | ], 8 | "license": "MIT", 9 | "authors": [ 10 | { 11 | "name": "Denis Duliçi", 12 | "email": "info@akaunting.com", 13 | "homepage": "https://akaunting.com", 14 | "role": "Developer" 15 | } 16 | ], 17 | "require": { 18 | "php": ">=5.5.9", 19 | "laravel/framework": ">=5.2.0" 20 | }, 21 | "autoload": { 22 | "psr-4": { 23 | "Akaunting\\Version\\": "./src" 24 | }, 25 | "files": [ 26 | "src/helpers.php" 27 | ] 28 | }, 29 | "extra": { 30 | "laravel": { 31 | "providers": [ 32 | "Akaunting\\Version\\Provider" 33 | ], 34 | "aliases": { 35 | "Version": "Akaunting\\Version\\Facade" 36 | } 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/Config/version.php: -------------------------------------------------------------------------------- 1 | 'Akaunting', 6 | 7 | 'code' => 'Start', 8 | 9 | 'major' => '1', 10 | 11 | 'minor' => '0', 12 | 13 | 'patch' => '0', 14 | 15 | 'build' => '', 16 | 17 | 'status' => 'Stable', 18 | 19 | 'date' => '10-August-2017', 20 | 21 | 'time' => '15:30', 22 | 23 | 'zone' => 'GMT +3', 24 | 25 | ]; 26 | -------------------------------------------------------------------------------- /src/Facade.php: -------------------------------------------------------------------------------- 1 | publishes([ 20 | __DIR__ . '/Config/version.php' => config_path('version.php'), 21 | ], 'version'); 22 | 23 | $this->app->singleton('version', function ($app) { 24 | return new Version($app); 25 | }); 26 | } 27 | 28 | /** 29 | * Register the application services. 30 | * 31 | * @return void 32 | */ 33 | public function register() 34 | { 35 | $this->mergeConfigFrom(__DIR__ . '/Config/version.php', 'version'); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/Version.php: -------------------------------------------------------------------------------- 1 | app = $app; 40 | $this->version = $app->version(); 41 | $this->is_lumen = Str::contains($this->version, 'Lumen'); 42 | } 43 | 44 | /** 45 | * Get name. 46 | * 47 | * @return string 48 | **/ 49 | public static function name() 50 | { 51 | return config('version.name'); 52 | } 53 | 54 | /** 55 | * Get code. 56 | * 57 | * @return string 58 | **/ 59 | public static function code() 60 | { 61 | return config('version.code'); 62 | } 63 | 64 | /** 65 | * Get major version. 66 | * 67 | * @return string 68 | **/ 69 | public static function major() 70 | { 71 | return config('version.major'); 72 | } 73 | 74 | /** 75 | * Get minor version. 76 | * 77 | * @return string 78 | **/ 79 | public static function minor() 80 | { 81 | return config('version.minor'); 82 | } 83 | 84 | /** 85 | * Get patch version. 86 | * 87 | * @return string 88 | **/ 89 | public static function patch() 90 | { 91 | return config('version.patch'); 92 | } 93 | 94 | /** 95 | * Get build version. 96 | * 97 | * @return string 98 | **/ 99 | public static function build() 100 | { 101 | return config('version.build'); 102 | } 103 | 104 | /** 105 | * Get status. 106 | * 107 | * @return string 108 | **/ 109 | public static function status() 110 | { 111 | return config('version.status'); 112 | } 113 | 114 | /** 115 | * Get date. 116 | * 117 | * @return string 118 | **/ 119 | public static function date() 120 | { 121 | return config('version.date'); 122 | } 123 | 124 | /** 125 | * Get time. 126 | * 127 | * @return string 128 | **/ 129 | public static function time() 130 | { 131 | return config('version.time'); 132 | } 133 | 134 | /** 135 | * Get zone. 136 | * 137 | * @return string 138 | **/ 139 | public static function zone() 140 | { 141 | return config('version.zone'); 142 | } 143 | 144 | /** 145 | * Get release version. 146 | * 147 | * @return string 148 | **/ 149 | public static function release() 150 | { 151 | return static::major() . '.' . static::minor(); 152 | } 153 | 154 | /** 155 | * Get short version. 156 | * 157 | * @return string 158 | **/ 159 | public static function short() 160 | { 161 | return static::release() . '.' . static::patch(); 162 | } 163 | 164 | /** 165 | * Get long version. 166 | * 167 | * @return string 168 | **/ 169 | public static function long() 170 | { 171 | return static::name() . ' ' . static::short() . ' ' 172 | . static::status() . ' [ ' . static::code() . ' ] ' . static::date() . ' ' 173 | . static::time() . ' ' . static::zone(); 174 | } 175 | } 176 | -------------------------------------------------------------------------------- /src/helpers.php: -------------------------------------------------------------------------------- 1 | $method(); 20 | } 21 | } 22 | --------------------------------------------------------------------------------