// sdk · Symfony
Pachet Symfony pentru API AstroWay
Oficial `astroway/sdk-symfony` pe Packagist — un pachet construit pe `astroway/sdk`. Se auto-registrează prin Symfony Flex, configurat prin fișierul standard `config/packages/astroway.yaml`, oferă un serviciu `Astroway\Astroway` autowireable pentru injectare în orice controlor sau serviciu. Compatibil cu Symfony 6.4 LTS și 7.x, PHP 8.1+.
// 01 / install
Instaleaz
composer require astroway/sdk-symfony import: use Astroway\Astroway;
Vezi n registru → astroway/sdk-symfony
// 02 / highlights
Caracteristici
- Symfony Flex auto-registrează
- Serviciu Astroway autowireable
- Fișier standard config/packages/astroway.yaml
- cheie api condusă de mediu
- Symfony 6.4 LTS + 7.x
// 03 / first request
Primul request
<?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);
}
} Start cu Symfony
10 000 de credite gratuite pe lun. SDK open-source, generat din OpenAPI 3.1, mereu sincronizat cu backend-ul.