1. Go to this page and download the library: Download proai/laravel-struct 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/ */
proai / laravel-struct example snippets
use App\Structs\GeoLocation;
use ProAI\Struct\Struct;
class Address extends Struct
{
public string $street;
public string $city;
public GeoLocation $geo_location;
}
use App\Structs\Address;
use Illuminate\Database\Eloquent\Model;
class User extends Model
{
protected $casts = [
'address' => Address::class,
];
}
use App\Structs\Address;
use Illuminate\Database\Eloquent\Model;
class User extends Model
{
protected $casts = [
'address' => Address::class.':composed',
];
}
use App\Structs\Address;
use ProAI\Struct\Collection;
class AddressCollection extends Collection
{
public $type = Address::class;
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.