A Laravel package for developers who love Nile beer and clean code.
gp10devhts/laravel-beer is a Laravel package for a laravel package for developers who love nile beer and clean code..
It currently has 2 GitHub stars and 6 downloads on Packagist (latest version v1.1.1).
Install it with composer require gp10devhts/laravel-beer.
Discover more Laravel packages by gp10devhts
or browse all Laravel packages to compare alternatives.
Last updated
A Laravel package for developers who love Nile beer and clean code. Enjoy coding with a cold brew in hand, and let Laravel do the heavy lifting.
Made for Nugsoft's Start of Year 2025. 🍻
composer require gp10devhts/laravel-beer
Enjoy your code, enjoy your beer!
This package provides a BeerService that you can use to get a friendly beer-related message.
You can inject Gp10devhts\LaravelBeer\BeerService into your controllers or other classes:
<?php
namespace App\Http\Controllers;
use Gp10devhts\LaravelBeer\BeerService; // Import the service
use Illuminate\Http\Request;
class YourController extends Controller
{
protected $beerService;
public function __construct(BeerService $beerService)
{
$this->beerService = $beerService;
}
public function showBeerMessage(Request $request)
{
$message = $this->beerService->getColdNileBeer();
// Example: return to a view
return view('your-view', ['beerMessage' => $message]);
// Or, return as JSON
// return response()->json(['message' => $message]);
}
}
app() or resolve() HelpersYou can also resolve the service directly from Laravel's service container:
// Using the app() helper
$beerService = app(Gp10devhts\LaravelBeer\BeerService::class);
$message = $beerService->getColdNileBeer();
// echo $message; // "Here's a cold Nile Beer for you!"
// Or using the resolve() helper
$anotherBeerServiceInstance = resolve(Gp10devhts\LaravelBeer\BeerService::class);
$anotherMessage = $anotherBeerServiceInstance->getColdNileBeer();
// echo $anotherMessage; // "Here's a cold Nile Beer for you!"
The BeerService is registered as a singleton, so you'll always receive the same instance within a single request lifecycle.
This package also comes with a fun Artisan command to serve you a virtual beer message directly in your terminal!
To use it, simply run:
php artisan beer:serve
This will display a random beer-related quote, a fun message, or the classic "Here's a cold Nile Beer for you!" message.
php artisan beer:cheers {name?}
php artisan beer:cheers Julesphp artisan beer:wisdom
php artisan beer:wisdomphp artisan beer:happy-hour
php artisan beer:happy-hourphp artisan beer:empty-keg
php artisan beer:empty-kegview:clear and cache:clear.php artisan beer:open
php artisan serve, but with some encouraging beer-themed messages.php artisan beer:openphp artisan serve output.php artisan beer:test {--passthru options}
php artisan test. It displays some beer-themed ASCII art and messages before running the tests.artisan test command (e.g., --coverage, or a test file/filter if supported by your setup).php artisan beer:testphp artisan beer:test --coveragephp artisan test output.