PHPackages                             soara/larastrom - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Admin Panels](/categories/admin)
4. /
5. soara/larastrom

ActivePackage[Admin Panels](/categories/admin)

soara/larastrom
===============

048PHP

Since Apr 30Pushed 1y agoCompare

[ Source](https://github.com/soara-dev/larastrom)[ Packagist](https://packagist.org/packages/soara/larastrom)[ RSS](/packages/soara-larastrom/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (3)Used By (0)

All In One Fullstack Tools For Laravel ( Larastrom )
====================================================

[](#all-in-one-fullstack-tools-for-laravel--larastrom-)

[![Latest Version on Packagist](https://camo.githubusercontent.com/e622e00ce8db3a34e75c481531b04ee7ed610e4480cfe4aed7c0ef74e82a36cc/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f736f6172612f6c6172617374726f6d2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/soara/larastrom)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Build Status](https://camo.githubusercontent.com/2850f75553b1ae085193c3f03a0fde449ecf98ce8a1b596578f69fe28c287d2f/68747470733a2f2f696d672e736869656c64732e696f2f656e64706f696e743f75726c3d68747470733a2f2f6170702e6368697070657263692e636f6d2f70726f6a656374732f64633332356164372d363033392d343334352d386537372d3832383439326261306266312f7374617475732f7632267374796c653d666c61742d737175617265)](https://camo.githubusercontent.com/2850f75553b1ae085193c3f03a0fde449ecf98ce8a1b596578f69fe28c287d2f/68747470733a2f2f696d672e736869656c64732e696f2f656e64706f696e743f75726c3d68747470733a2f2f6170702e6368697070657263692e636f6d2f70726f6a656374732f64633332356164372d363033392d343334352d386537372d3832383439326261306266312f7374617475732f7632267374796c653d666c61742d737175617265)

Larastrom is a developer-friendly Laravel package that speeds up and simplifies the process of building RESTful APIs. It includes ready-to-use tools and smart defaults so you can focus on your business logic, not boilerplate code.

🚀 Features
----------

[](#-features)

- 🔐 **Automatic JWT Authentication**
    Built-in support for JWT-based auth with zero configuration.
- 🔁 **Consistent API Response Format**
    Unified response structure for success and error handling across all endpoints.
- 🔎 **Search &amp; Sorting Made Easy**
    Just pass query parameters like `?searchField[name]=john&sortField[created_at]=desc` — no extra code required.
- 📦 **Pagination Made Easy**Just pass query parameters like `?pageSize=10` — no extra code required.

---

Installation
------------

[](#installation)

```
composer require soara/larastrom

```

Add the `LarastromServiceProvider` to your `bootstrap/providers.php` file:

```
return [
    App\Providers\AppServiceProvider::class,
    Soara\Larastrom\LarastromServiceProvider::class, // add this line
    Tymon\JWTAuth\Providers\LaravelServiceProvider::class // add this line
];
```

Usage
-----

[](#usage)

- [JWT Authentication](#jwt-authentication)
- [Response Format](#response-format)
- [Model Builder](#model-builder)

### JWT Authentication

[](#jwt-authentication)

To enable authentication please run the following command:

```
php artisan install:api
php artisan larastrom:install-auth

# jwt
php artisan jwt:secret

# spatie
php artisan vendor:publish --provider="Spatie\Permission\PermissionServiceProvider"
php artisan migrate

```

Add Middleware for jwt verify in file `bootstrap/app.php`:

```
->withMiddleware(function (Middleware $middleware) {
    $middleware->alias([
        'jwt.verify' => App\Http\Middleware\JwtVerify::class,
    ]);
})
```

Setup default guard in file `config/auth.php`:

```
'defaults' => [
    'guard' => 'api',
    'passwords' => 'users',
],

'guards' => [
    'api' => [
        'driver' => 'jwt',
        'provider' => 'users',
    ],
],
```

Add authtenticate route to file `routes/api.php`:

```
use App\Http\Controllers\Api\Auth\AuthController;

Route::prefix('auth')->group(function () {
    Route::post('login', [AuthController::class, "login"]);
    Route::middleware('jwt.verify')->group(function () {
        Route::post('me', [AuthController::class, "me"]);
        Route::post('logout', [AuthController::class, "logout"]);
        Route::post('refresh', [AuthController::class, "refresh"]);
    });
});
```

Update your `User` model:

```
