PHP code example of polaris / core

1. Go to this page and download the library: Download polaris/core library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

polaris / core example snippets


use Polaris\Config\EnvironmentConfig;
use Polaris\Polaris;
use Polaris\Wiring\Config;

$polaris = Polaris::create(new Config(
    secrets: EnvironmentConfig::secrets(),   // APP_KEY, AUTH_JWT_* from the environment
    auth: EnvironmentConfig::auth(),         // issuer, audience, feature flags
    database: $adapter,                      // Polaris\Contract\DatabaseAdapter
    mailer: $mailer,                         // OtpMailerInterface: verification, reset and OTP emails
    sms: $sms,                               // SmsSenderInterface
    dispatcher: $dispatcher,                 // PSR-14; subscribe $polaris->listeners()
));

$polaris->graph()->login();   // every service, built once, no container
$polaris->manifest();         // the 52 endpoints declared in api/**/*.yaml
$polaris->schema();           // the tables, as data