1. Go to this page and download the library: Download jdiassdev/laravel-types-gen 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/ */
jdiassdev / laravel-types-gen example snippets
public function rules(): array
{
return [
'name' => '|integer|nullable',
'bio' => 'string',
];
}
public function rules(): array
{
return [
'name' => ['
public function rules(): array
{
return [
'address.city' => 'd|string',
'items.*.qty' => '
// config/laravel-types-gen.php
return [
/*
|--------------------------------------------------------------------------
| Output Path
|--------------------------------------------------------------------------
|
| The directory where the generated TypeScript files will be written.
| Both api-request.ts and api-resource.ts are placed inside this path.
|
*/
'output_path' => resource_path('types'),
];
bash
php artisan ts:generate
bash
php artisan ts:generate
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.