Framework Integration
Integration in Laravel
3k Downloads / Month
Open Source MIT License
3k Downloads / Month
Open Source MIT License
Explore how to integrate Intervention Zodiac with the Laravel framework. Learn to set up configuration files and use the calculator via static facades.
Although the library is framework agnostic it comes with a service provider for the Laravel Framework. Which will be discovered automatically and registers the calculator into your installation.
A global configuration file that is recognized by Laravel is included. It is therefore possible to configure a default setting for the astrology to be used by the calculator facade.
The configuration file can be copied to the application with the following command.
php artisan vendor:publish --provider="Intervention\Zodiac\Laravel\ServiceProvider"
This command will publish the configuration file config/zodiac.php to your local
applications config folder. Here you can set the default astrology type to be used for
calculations.
return [ /* |-------------------------------------------------------------------------- | Zodiac Astrology |-------------------------------------------------------------------------- | | Define the default astrology that is to be used application-wide | for calculating zodiac signs. Your can choose between western | and chinese astrology. */ 'astrology' => \Intervention\Zodiac\Astrology::WESTERN, ];
This package also integrates access to the central entry point Intervention\Zodiac\Calculator::class, via a static facade.
The following code example shows how to calculate a zodiac sign via the zodiac facade in a Laravel application.
use Illuminate\Http\Request; use Intervention\Zodiac\Laravel\Facades\Zodiac; Route::get('/', function (Request $request) { $sign = Zodiac::calculate($request->input('date')); });