Verify whether app is Laravel or Lumen and get its version
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
src Fix for Lumen May 11, 2018
tests Fix for Lumen May 11, 2018
.coveralls.yml Add Coveralls file Jan 7, 2018
.gitignore Initial commit Jan 7, 2018
.php_cs Add PhpCSFixer file Jan 7, 2018
.travis.yml Add Travis CI file Jan 7, 2018
LICENSE Add License file Jan 7, 2018
composer.json Fix for Lumen May 11, 2018
composer.lock Fix for Lumen May 11, 2018
phpunit.xml Add PHPUnit configuration file Jan 7, 2018
readme.md Update readme Jan 7, 2018

readme.md

Laravel Version

Build Status Coverage Status Scrutinizer Code Quality Packagist

This package let you verify whether current application is Laravel or Lumen, get application version and verify whether application is minimum at given version string.

Installation

  1. Run

    composer require mnabialek/laravel-version

    in console to install this module

  2. That's it! Installation is complete. You don't need to adjust any config or install service providers.

Usage

Just run:

$version = app()->make(\Mnabialek\LaravelVersion\Version);

(you can obviously use dependency injection) and then use one of available methods for example like this

$result = $version->isLaravel();

or

if ($version->isLaravel()) {
   // do something
}

Available methods

  • isLaravel() - verify whether application is Laravel (true for Laravel, false for Lumen)
  • isLumen() - verify whether application is Lumen (true for Lumen, false for Laravel)
  • full() - get full version string (keep in mind for Lumen it can be for example: 'Lumen (5.5.2) (Laravel Components 5.5.*)')
  • get() - get version (for Both Laravel and Lumen it will contain only version number for example 5.5.2)
  • min($checkedVersion) - verify whether application is minimum at given version. As $checkedVersion you should pass version you want to verify for example 5.5 or 5.5.21

Licence

This package is licenced under the MIT license