PHP code example of stubbedev / laravel-stoli

1. Go to this page and download the library: Download stubbedev/laravel-stoli 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/ */

    

stubbedev / laravel-stoli example snippets


'client' => 'fetch', // or 'axios' (npm install axios), or null

'client' => 'fetch',    // the query options call the router, so a client is 

#[TypeScriptConstants]           // or #[TypeScriptConstants('Name')] to rename it
final class Permission           // in App\Support
{
    public const VIEW = 'view';
    public const EDIT = 'edit';
}

#[TypeScriptConstants]
enum Status: string
{
    case Draft = 'draft';
    case Live = 'live';
}

return [
    'split'          => true,   // one file per module, or all in `single.name`
    'transform'      => true,   // generate with typescript:transform
    'client'         => null,   // 'fetch', 'axios' or null
    'urls'           => false,  // per-route URL functions
    'query'          => null,   // 'tanstack' or null, needs a client
    'import_aliases' => [],     // e.g. ['@' => base_path('frontend')]
    'single'         => ['name' => 'api'],
    'constants'      => ['enabled' => true, 'name' => 'constants', 'path' => null, 'paths' => null],
    'modules'        => [
        ['match' => '*', 'name' => 'api', 'rootUrl' => env('APP_URL'), 'absolute' => true],
    ],
];
bash
composer vendor:publish --provider="Spatie\LaravelTypeScriptTransformer\TypeScriptTransformerServiceProvider"
php artisan vendor:publish --tag=stoli