laravie / serialize-queries by crynobone

Serializable Laravel Query Builder
4,797,341
67
4
Package Data
Maintainer Username: crynobone
Maintainer Contact: crynobone@gmail.com (Mior Muhammad Zaki)
Package Create Date: 2020-09-15
Package Last Update: 2024-11-21
Home Page:
Language: PHP
License: MIT
Last Refreshed: 2024-12-17 03:07:42
Package Statistics
Total Downloads: 4,797,341
Monthly Downloads: 119,424
Daily Downloads: 5,223
Total Stars: 67
Total Watchers: 4
Total Forks: 5
Total Open Issues: 0

Serializable Laravel Query Builder

Build Status Latest Stable Version Total Downloads Latest Unstable Version License Coverage Status

Serialize Queries allows developer to serialize Query/Eloquent Builder to be used in Laravel Queues.

Installation

To install through composer, run the following command from terminal:

composer require "laravie/serialize-queries"

Usages

Serialize Eloquent Builder

Laravie\SerializesQuery\Eloquent::serialize(\Illuminate\Database\Eloquent\Builder $builder): array;

The method provide simple interface to serialize Eloquent Builder.

use App\Model\User;
use Laravie\SerializesQuery\Eloquent;

$query = User::has('posts')->where('age', '>', 25);

$serializedQuery = Eloquent::serialize($query);

Unserialize Eloquent Builder

Laravie\SerializesQuery\Eloquent::unserialize(array $payload): \Illuminate\Database\Eloquent\Builder;

The method provide simple interface to unserialize Eloquent Builder.

use Laravie\SerializesQuery\Eloquent;


$query = Eloquent::unserialize($serializedQuery);