1. Go to this page and download the library: Download yish/generators 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/ */
php
namespace Yish\Generators\Foundation\Transform;
interface TransformContract
{
public function transform($attributes);
}
php
// $instance => Transformer class.
// $attributes => Need transform data, maybe array or collection etc.
transformer(UserTransformer::class, $data);
bash
$ php artisan make:formatter UserFormatter
php
namespace App\Formatters;
use Illuminate\Http\Request;
use Yish\Generators\Foundation\Format\FormatContract;
use Yish\Generators\Foundation\Format\Statusable;
class PostFormatter implements FormatContract
{
public function format(Request $request, $items = [], $message = '', $status = 200)
{
//
}
}
php
namespace Yish\Generators\Foundation\Format;
use Illuminate\Http\Request;
interface FormatContract
{
public function format(Request $request, $items = []);
}
php
// $request => Must instance of `Illuminate\Http\Request`.
// $instance => Formatter class.
// $items => data.
formatter(request(), UserFormatter::class, $data);
bash
$ php artisan make:presenter UserPresenter
php
namespace App\Presenters;
class UserPresenter
{
//
}
bash
$ php artisan make:foundation Taggable
php
namespace App\Foundation;
class Taggable
{
//
}
bash
$ php artisan make:transport UserTransport
php
namespace App\Transports;
class UserTransport
{
//
}
bash
$ php artisan make:parser UserParser
php
namespace App\Parsers;
use Yish\Generators\Foundation\Parser\Parser;
class UserParser extends Parser
{
public function parse(array $items)
{
return parent::parse($items);
}
public function keys()
{
return [
'name',
'ages',
'location'
];
}
}
php
namespace App\Responses;
use Illuminate\Contracts\Support\Responsable;
class UserResponse implements Responsable
{
public function toResponse($request)
{
//
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.