PHP code example of wp-grogu / laravel-fluent-plus
1. Go to this page and download the library: Download wp-grogu/laravel-fluent-plus 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/ */
wp-grogu / laravel-fluent-plus example snippets
class MyContainer extends FluentPlus
{
protected $casts = [
// Use the contents of the `names` attribute
// to initialize a new `NamesContainer` instance.
'names' => NamesContainer::class,
// Assumes that the `price` attribute contains
// an array and initializes a new `Price` instance
// for every item.
'prices' => [Price::class],
// The same as the array syntax but using
// Laravel's `Collection` class instead.
'stock' => [
\Illuminate\Support\Collection::class,
StockLevel::class
],
];
}
$container = new MyContainer($sourceAssoc);
var_dump($container->names->english);
var_dump($container->prices[0]->amount);
var_dump($container->stock->get('store_1')->quantity);
$instance = new Fluent(['foo' => ['bar' => 'baz']]);
$instancePlus = new FluentPlus(['foo' => ['bar' => 'baz']]);
// breaks :(
var_dump($instance->foo->bar);
// works :)
var_dump($instancePlus->foo->bar);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.