1. Go to this page and download the library: Download victormgomes/query-params 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/ */
victormgomes / query-params example snippets
use Victormgomes\QueryParams\Attributes\MapQueryParams;
use Victormgomes\QueryParams\Concerns\HasQueryParams;
use App\Models\User;
#[MapQueryParams(User::class)]
class IndexUserRequest extends FormRequest
{
use HasQueryParams;
}
public function index(IndexUserRequest $request)
{
// The QueryBuilder uses the validated and normalized data automatically
return QueryBuilder::build(User::class, $request);
}
// In your controller or service
return Resource::getDefinitiveMetadata(User::class);