Laravel and Lumen Badge Generator
, (*1)
, (*2)
That package is a easy wrapper to Badges/Poser., (*3)
Installing
composer require vluzrmos/laravel-badge-poser
Laravel
configure the aliases and providers on Laravel config/app
:, (*4)
The provider:, (*5)
'Vluzrmos\BadgePoser\BadgePoserSeviceProvider',
and the alias:, (*6)
'Poser' => 'Vluzrmos\BadgePoser\PoserFacade',
Lumen
edit the bootstrap/app.php
:, (*7)
$app->register('Vluzrmos\BadgePoser\BadgePoserSeviceProvider');
//register the facade, if you need
if(!class_exists('Poser')){
class_alias('Vluzrmos\BadgePoser\PoserFacade', 'Poser');
}
Usage
Using IoC Container, (*8)
class YourController extends Controller
{
public function controllerMethod(\Vluzrmos\BadgePoser\Contracts\Poser $poser)
{
return $poser->generate('slogan', 'status', 'FFFFFF', 'flat');
}
}
Facade
$response = Poser::generate('licence', 'MIT', 'FFFFF', 'plastic');
API
$response = Poser::generate($message, $status, $color, $format);
//where $format is 'flat' or 'plastic'
$response = Poser::generateFromURI('license-MIT-428F7E.plastic');
Example
., (*9)
License
DBAD., (*10)