// sdk · Symfony
Bundle Symfony untuk API AstroWay
Resmi `astroway/sdk-symfony` di Packagist — Bundle yang dibangun di atas `astroway/sdk`. Mendaftar secara otomatis melalui Symfony Flex, dikonfigurasi melalui file `config/packages/astroway.yaml` standar, mengekspos layanan `Astroway\Astroway` yang dapat dihubungkan untuk disuntikkan ke dalam kontroler atau layanan apa pun. Kompatibel dengan Symfony 6.4 LTS dan 7.x, PHP 8.1+.
// 01 / install
Pasang
composer require astroway/sdk-symfony impor: use Astroway\Astroway;
Lihat di registry → astroway/sdk-symfony
// 02 / highlights
Fitur Unggulan
- Pendaftaran otomatis Symfony Flex
- Layanan Astroway yang dapat dihubungkan
- Konfigurasi standar config/packages/astroway.yaml
- Kunci api yang diarahkan oleh lingkungan
- Symfony 6.4 LTS + 7.x
// 03 / first request
Permintaan pertama
<?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);
}
} Mulai dengan Symfony
10.000 kredit gratis per bulan. SDK open-source, dibuat dari OpenAPI 3.1, selalu sinkron dengan backend.