PHPackages                             ashimbadrie/lara-core - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. ashimbadrie/lara-core

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

ashimbadrie/lara-core
=====================

Contains base classes as well as helper classes to fast track development.

00PHP

Since Oct 14Pushed 4y ago1 watchersCompare

[ Source](https://github.com/ashimbadrie/lara-core)[ Packagist](https://packagist.org/packages/ashimbadrie/lara-core)[ RSS](/packages/ashimbadrie-lara-core/feed)WikiDiscussions main Synced 4w ago

READMEChangelogDependenciesVersions (1)Used By (0)

Lara Core
=========

[](#lara-core)

Quickly and easily create CRUD for Laravel API using these handy base classes.

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

[](#installation)

```
composer require ashimbadrie/lara-core
```

Pre-Requisites
--------------

[](#pre-requisites)

This package expects your database migrations to include the following required fields. By default, we turned off laravel's timestamp usage and opt-in for our custom create/update UNIX timestamp. We also added the ability to log who created/updated a record once authenticated.

```
$table->integer('created_by')->nullable()->comment('User who created the record');
$table->integer('created_on')->nullable()->comment('The date of creation in unix timestamp');
$table->integer('modified_by')->nullable()->comment('User who modified the record');
$table->integer('modified_on')->nullable()->comment('The date of modification in unix timestamp');
```

Creating a Data Model
---------------------

[](#creating-a-data-model)

A *data model* is the entrypoint to creating records in a database table. When a record is saved, the model tracks which *authenticated* user **creates/modifies** a record and also tracks the **UNIX timestamp** for these operations.

Creating a data model is as simple as follows:

```
class ExampleModel extends BaseModel {

  protected $table = 'example_table';

  protected function defaultLookupField(): String
  {
      return '';
  }

}
```

REST API CRUD
-------------

[](#rest-api-crud)

To handle basic REST API CRUD operations, we need to create a *data manager* and *data controller* as follows:

```
class ExampleManager extends DataManager {

  public function __construct()
  {
      $model = "App\Models\ExampleModel"; // Path to the ExampleModel we created above
      parent::__construct($model);
  }

}

class ExampleController extends DataController {

  private $exampleManager;

  public function __construct()
  {
      $this->exampleManager = new ExampleManager();
      parent::__construct($this->exampleManager);
  }

}
```

Once we have our *data model*, *data controller* and *data manager* set up we can now create our API resources to point to the CRUD logic. Inside the **routes/api.php** file, we add the following:

```
Route::get('examples/{id}', 'ExampleController@show');
Route::post('examples', 'ExampleController@store');
Route::patch('examples/{id}', 'ExampleController@update');
Route::delete('examples/{id}', 'ExampleController@destroy');
```

Paginated Record Listing
------------------------

[](#paginated-record-listing)

In order to load a paginated list of records, we need to create a *list manager* and *list controller* as follows:

```
class ExampleListManager extends DataListManager
{
    public function __construct()
    {
        $model = "App\Models\Example";
        parent::__construct($model);
    }
}

class ExampleListController extends DataListController
{
    private $exampleListManager;

    public function __construct()
    {
        $this->exampleListManager = new ExampleListManager();
        parent::__construct($this->exampleListManager);
    }
}
```

Once we have our *data list controller* and *data list manager* we can now create our API resources to point to the listing logic. Inside the **routes/api.php** file, we add the following:

```
Route::post('examples/list', 'ExampleListController@page');
Route::get('examples/list', 'ExampleListController@index');
```

The listing *post* request accepts an *application/json* payload to load the first page as follows:

```
{
  "start": 0,
  "limit": 10,
  "sort_by": {},
  "filter_by": {}
}
```

> NOTE: Your frontend will need to increment the start value in the payload above to cycle through a paginated list.

A typical response looks as follows:

```
{
  "page": [],
  "total": 0
}
```

Add filters to listing
----------------------

[](#add-filters-to-listing)

TODO

Sort listing
------------

[](#sort-listing)

TODO

###  Health Score

14

—

LowBetter than 2% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity0

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity28

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/3bf4abb3b35a3e8e9a0dd4b91277bc4858af926ea120ee1c98066cbb94c9a730?d=identicon)[ashimbadrie](/maintainers/ashimbadrie)

---

Top Contributors

[![ashimbadrie](https://avatars.githubusercontent.com/u/46768852?v=4)](https://github.com/ashimbadrie "ashimbadrie (16 commits)")

### Embed Badge

![Health badge](/badges/ashimbadrie-lara-core/health.svg)

```
[![Health](https://phpackages.com/badges/ashimbadrie-lara-core/health.svg)](https://phpackages.com/packages/ashimbadrie-lara-core)
```

###  Alternatives

[symfony/polyfill-uuid

Symfony polyfill for uuid functions

688335.4M63](/packages/symfony-polyfill-uuid)[spatie/error-solutions

This is my package error-solutions

6853.2M11](/packages/spatie-error-solutions)[phpflo/phpflo

Flow-based programming for PHP

2173.3k4](/packages/phpflo-phpflo)[eftec/autoloadone

AutoloadOne is a program that generates an autoload class for PHP.

403.4k](/packages/eftec-autoloadone)[ys-tools/default-theme-configuration-bundle

OroCommerce Default Theme Configuration Bundle

124.2k](/packages/ys-tools-default-theme-configuration-bundle)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
