Top 7 Laragento compatible Packages. Magento 2 Laravel integrations.

Yegor Shytikov
3 min readDec 23, 2023

LaraGento is a collection of PHP classes built on top of Eloquent ORM (from the Laravel framework), that provides a fluent interface to connect and get data directly from a Magento database.

You can use legacy Magento 2 as the backend (administration panel), and any other PHP app (Symfony/Laravel/Lumen/Vanilla.PHP etc.) and query that data (as a Model layer). It’s easier to use Laragento with Laravel, but you’re free to use it with any PHP project using Composer.

Laragento’s actual potential is found in the Laravel ecosystem of third-party programs that it nurtures. There are thousands of high-quality packages to choose from compared to bad-quality magento extensions.

  1. Laravel Sanctum (Authentication)

Any application requires secure user authentication. Laravel Sanctum is an API-based authentication system that is both easy and powerful. Sanctum integrates neatly with Laravel’s user and authorization systems, allowing you to construct secure APIs quickly and easily.

Creating an API token for a user, for example:

$user = User::find(1);
$token = $user->createToken('my-api-token');

2. Livewire (Interactivity in real time)

Forget about page reloads and cumbersome forms! Livewire adds real-time interactivity to your Laragento applications. Create a current and seamless user experience by updating your UI as users interact without leaving the page.

Making a real-time counter as an example:

// Counter component
class Counter extends Component
{
public $count = 0;
    public function increment()
{
$this->count++;
}
public function render()
{
return view('counter', ['count' => $this->count]);
}
}

3. Laravel Telescope (Debugging)

Debugging complex Laragento SPI may be a maze. With detailed performance insights, database queries, mail logs, and even event handling visualization, Laravel Telescope clarifies the process. Put an end to hours of blind digging!

Inspecting database queries as an example:

Telescope::recordQuery('My Important Query', function () {
DB::table('users')->get();
});

4. Algolia Meilisearch (Search functionality)

Instant and relevant search results are critical for modern applications. Algolia Meilisearch works in tandem with Laragento to provide lightning-fast data search with customized filters and faceting options.

Searching for users by name and email, for example:

$users = Meilisearch::index('users')->search(
query: 'john doe',
filters: ['email' => 'johndoe@example.com']
);

5. Laravel Maatwebsite Excel (Import & Export):

Maatwebsite Laravel Excel makes it simple to import and export Excel files, edit data within them, and even create new spreadsheets.

Exemplification: When exporting user data to an Excel file:

Excel::create('users', function ($excel) {
$excel->sheet('Users', function ($sheet) {
$sheet->fromArray(User::all()->toArray());
});
})->download('xlsx');

6. Laravel Spatie Queues (Background Jobs):

Long-running operations might stifle the performance of your application. Spatie Laravel Queues allows you Laragento microservice to offload such activities to the background, ensuring that your application remains responsive while asynchronously processing hefty jobs.

As an example, consider dispatching a job to handle emails:

Queue::push(new SendEmailJob($user, $message));

7. Laravelizer (Automatic API Generation)

Laravelizer is a Laravel package that analyzes current route definitions and creates API documentation, controllers, and configuration files automatically. This saves you time and effort by eliminating the need for manual code, boilerplate generation, and API design documentation.

For example, Consider a Laravel route that retrieves users based on their ID:

Route::get('/users/{id}', function ($id) {
return User::find($id);
});

Laravelizer is a game changer for Laragento, who wants to create APIs quickly, efficiently, and with the least amount of work. It eliminates time-consuming procedures, improves code maintainability, and provides uniform documentation, making it a valuable asset for any Laragento project that requires API access. So, if you want to streamline your API development process and save time, Laravelizer is definitely worth investigating.

Have fun coding without Magento 2 BS!

--

--

Yegor Shytikov

True Stories about Magento 2. Melting down metal server infrastructure into cloud solutions.