Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
nassimnasibullah committed Nov 2, 2020
0 parents commit 2d08ffe
Show file tree
Hide file tree
Showing 14 changed files with 538 additions and 0 deletions.
18 changes: 18 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
; This file is for unifying the coding style for different editors and IDEs.
; More information at https://editorconfig.org

root = true

[*]
charset = utf-8
indent_size = 4
indent_style = space
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true

[*.md]
trim_trailing_whitespace = false

[*.yml]
indent_size = 2
25 changes: 25 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Set the default behavior, in case people don't have core.autocrlf set.
* text eol=lf

# Explicitly declare text files you want to always be normalized and converted
# to native line endings on checkout.
*.c text
*.h text

# Declare files that will always have CRLF line endings on checkout.
*.sln text eol=crlf

# Denote all files that are truly binary and should not be modified.
*.png binary
*.jpg binary
*.otf binary
*.eot binary
*.svg binary
*.ttf binary
*.woff binary
*.woff2 binary

*.css linguist-vendored
*.scss linguist-vendored
*.js linguist-vendored
CHANGELOG.md export-ignore
37 changes: 37 additions & 0 deletions .github/workflows/php.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: PHP Composer

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: Validate composer.json and composer.lock
run: composer validate

- name: Cache Composer packages
id: composer-cache
uses: actions/cache@v2
with:
path: vendor
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-php-
- name: Install dependencies
if: steps.composer-cache.outputs.cache-hit != 'true'
run: composer install --prefer-dist --no-progress --no-suggest

# Add a test script to composer.json, for instance: "test": "vendor/bin/phpunit"
# Docs: https://getcomposer.org/doc/articles/scripts.md

# - name: Run test suite
# run: composer run-script test
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/vendor
composer.phar
composer.lock
.DS_Store
4 changes: 4 additions & 0 deletions .styleci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
preset: psr2

enabled:
- concat_with_spaces
43 changes: 43 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
sudo: false
language: php


php:
# Versions of PHP you want your project run with.
- 5.6
- 7.0
- 7.1
- 7.2
- 7.3
- nightly

env:
global:
- setup=basic

matrix:
fast_finish: true
allow_failures:
- php: nightly
include:
- php: 5.6
env: setup=lowest
- php: 5.6
env: setup=stable


before_install:
- travis_retry composer self-update
- travis_retry composer install --prefer-source --no-interaction
- composer clear-cache

install:
- if [[ $setup = 'basic' ]]; then travis_retry composer update --no-interaction --prefer-dist --no-suggest; fi
- if [[ $setup = 'stable' ]]; then travis_retry composer update --prefer-dist --no-interaction --prefer-stable --no-suggest; fi
- if [[ $setup = 'lowest' ]]; then travis_retry composer update --prefer-dist --no-interaction --prefer-lowest --prefer-stable --no-suggest; fi

script:


after_script:

21 changes: 21 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) 2020 Spinzar

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
73 changes: 73 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# Version management package for Laravel.
[![Release](https://img.shields.io/github/v/release/spinzar/version?label=release)](https://github.com/spinzar/version/releases)
![Downloads](https://img.shields.io/github/downloads/spinzar/version/total?label=downloads)
[![Tests](https://img.shields.io/github/workflow/status/spinzar/version/Tests?label=tests)](https://github.com/spinzar/version/actions)
[![License](https://img.shields.io/github/license/spinzar/version?label=license)](LICENSE.txt)



A [SemVer](http://semver.org) compatible version management package for softwares built on Laravel.

## Getting Started

### 1. Install

Run the following command:

```bash
composer require spinzar/version
```

### 2. Register (for Laravel < 5.5)

Register the service provider in `config/app.php`

```php
Spinzar\Version\Provider::class,
```

Add alias if you want to use the facade.

```php
'Version' => Spinzar\Version\Facade::class,
```

### 3. Publish

Publish config file.

```bash
php artisan vendor:publish --tag=version
```


### 4. Configure

You can change the version information of your app from `config/version.php` file

## Usage

### version($method = null)

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()`

## Changelog

Please see [Releases](../../releases) for more information what has changed recently.

## Contributing

Pull requests are more than welcome. You must follow the PSR coding standards.

## Security

If you discover any security related issues, please email [email protected] instead of using the issue tracker.

## Credits

- [Nassim Nasibullah](https://github.com/spinzar)
- [All Contributors](../../contributors)

## License

The MIT License (MIT). Please see [LICENSE](LICENSE.md) for more information.
39 changes: 39 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
"name": "spinzar/version",
"description": "Version management package for Laravel.",
"keywords": [
"laravel",
"version"
],
"license": "MIT",
"authors": [
{
"name": "Nassim Nasibullah",
"email": "[email protected]",
"homepage": "https://spinzar.co",
"role": "Developer"
}
],
"require": {
"php": "^5.6.0|^7.0|^7.1|^7.2|^7.3|^7.4",
"laravel/framework": "5.4.*|5.5.*|5.6.*|5.7.*|5.8.*|6.*|7.*|8.*"
},
"autoload": {
"psr-4": {
"Spinzar\\Version\\": "./src"
},
"files": [
"src/helpers.php"
]
},
"extra": {
"laravel": {
"providers": [
"Spinzar\\Version\\Provider"
],
"aliases": {
"Version": "Spinzar\\Version\\Facade"
}
}
}
}
25 changes: 25 additions & 0 deletions src/Config/version.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?php

return [

'name' => 'Spinzar',

'code' => 'argon',

'major' => '1',

'minor' => '0',

'patch' => '0',

'build' => '',

'status' => 'Stable',

'date' => '02-November-2020',

'time' => '21:00',

'zone' => 'GMT +9',

];
16 changes: 16 additions & 0 deletions src/Facade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?php

namespace Spinzar\Version;

use Illuminate\Support\Facades\Facade as BaseFacade;

class Facade extends BaseFacade
{
/**
* Get the registered name of the component.
*/
public static function getFacadeAccessor()
{
return 'version';
}
}
37 changes: 37 additions & 0 deletions src/Provider.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?php

namespace Spinzar\Version;

use Illuminate\Routing\Router;
use Illuminate\Support\ServiceProvider;

class Provider extends ServiceProvider
{
/**
* Bootstrap the application services.
*
* @param Router $router
*
* @return void
*/
public function boot(Router $router)
{
$this->publishes([
__DIR__ . '/Config/version.php' => config_path('version.php'),
], 'version');

$this->app->singleton('version', function ($app) {
return new Version($app);
});
}

/**
* Register the application services.
*
* @return void
*/
public function register()
{
$this->mergeConfigFrom(__DIR__ . '/Config/version.php', 'version');
}
}
Loading

0 comments on commit 2d08ffe

Please sign in to comment.