// sdk · Symfony
Bundle Symfony per l'API AstroWay
Ufficiale `astroway/sdk-symfony` su Packagist — un Bundle basato su `astroway/sdk`. Si registra automaticamente tramite Symfony Flex, configurato tramite il file `config/packages/astroway.yaml` standard, espone un servizio `Astroway\Astroway` autowireable per l'iniezione in qualsiasi controller o servizio. Compatibile con Symfony 6.4 LTS e 7.x, PHP 8.1+.
// 01 / install
Installa
composer require astroway/sdk-symfony importa: use Astroway\Astroway;
Vedi nel registro → astroway/sdk-symfony
// 02 / highlights
Funzionalità
- Registrazione automatica Symfony Flex
- Servizio Astroway autowireable
- Configurazione standard config/packages/astroway.yaml
- Chiave api guidata dall'ambiente
- Symfony 6.4 LTS + 7.x
// 03 / first request
Prima richiesta
<?php
// config/packages/astroway.yaml
// astroway:
// api_key: '%env(ASTROWAY_API_KEY)%'
use Astroway\Astroway;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\Routing\Attribute\Route;
final class ChartController extends AbstractController
{
public function __construct(private readonly Astroway $astroway) {}
#[Route('/chart')]
public function chart(): JsonResponse
{
$chart = $this->astroway->post('/chart', body: [
'date' => '1990-07-14',
'time' => '14:30:00',
'timezoneOffset' => 3,
'latitude' => 50.4501,
'longitude' => 30.5234,
'houseSystem' => 'P',
]);
return $this->json($chart);
}
} Inizia con Symfony
10.000 crediti gratis al mese. SDK open-source, generato da OpenAPI 3.1, sempre sincronizzato con il backend.