// sdk · Laravel
ServiceProvider di Laravel per l'API di AstroWay
Ufficiale `astroway/sdk-laravel` su Packagist — un ServiceProvider + facade sopra `astroway/sdk`. Auto-rilevato tramite `composer.json` `extra.laravel.providers`, `Astroway\Astroway` registrato come singleton nel container, config pubblicato con `php artisan vendor:publish`. Inietta nei controller o usa la facade `Astroway::post("/chart", ...)`. Funziona con Laravel 10/11/12, PHP 8.1+.
// 01 / install
Installa
composer require astroway/sdk-laravel importa: use Astroway\Astroway;
Vedi nel registro → astroway/sdk-laravel
// 02 / highlights
Funzionalità
- ServiceProvider auto-rilevato
- Facade Astroway
- Config tramite vendor:publish
- Chiave ASTROWAY_API_KEY in .env
- Laravel 10/11/12
// 03 / first request
Prima richiesta
<?php
// .env: ASTROWAY_API_KEY=aw_live_...
use Astroway\Astroway;
use Illuminate\Http\JsonResponse;
class ChartController extends Controller
{
public function __invoke(Astroway $astroway): JsonResponse
{
$chart = $astroway->post('/chart', body: [
'date' => '1990-07-14',
'time' => '14:30:00',
'timezoneOffset' => 3,
'latitude' => 50.4501,
'longitude' => 30.5234,
'houseSystem' => 'P',
]);
return response()->json($chart);
}
} Inizia con Laravel
10.000 crediti gratis al mese. SDK open-source, generato da OpenAPI 3.1, sempre sincronizzato con il backend.