PHPackages                             laralearn/larastructor - 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. laralearn/larastructor

ActiveLibrary

laralearn/larastructor
======================

An artisan companion for Laravel learners to create Models, Services, and Repositories.

30PHP

Since Jun 24Pushed 10mo ago1 watchersCompare

[ Source](https://github.com/lokeshrangani/larastructor)[ Packagist](https://packagist.org/packages/laralearn/larastructor)[ RSS](/packages/laralearn-larastructor/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

LaraStructor - Laravel Structure Generator
==========================================

[](#larastructor---laravel-structure-generator)

A set of Artisan commands to automatically generate **Repository**, **Interface**, and **Service** classes in your Laravel application with clean structure and naming conventions. Inspired by clean architecture — made simple and fun!

---

Requirements
------------

[](#requirements)

- Laravel 8 or above
- PHP 8.0+
- Your model classes should exist before running the repository generation

---

Generated Folder Structure Example
----------------------------------

[](#generated-folder-structure-example)

```
app/
├── Models/
│   └── Product.php
├── Repositories/
│   ├── ProductRepository.php
│   └── Interfaces/
│       └── ProductRepositoryInterface.php
├── Services/
│   └── ProductService.php

```

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

[](#installation)

```
composer require laralearn/larastructor

```

Available Commands
------------------

[](#available-commands)

1. Make a Model
---------------

[](#1-make-a-model)

```
php artisan larastruct:make-model

```

You'll be prompted for:

```
    Model name
    Table name
    Fillable fields
    Hidden fields
    Soft delete support

```

What it does:

```
    Checks if the model already exists in the given path
    Creates a model file inside app/Models

```

2. Generate Repository &amp; Interface
--------------------------------------

[](#2-generate-repository--interface)

```
php artisan larastruct:make-repository {model} --model-path=Models

```

Options:

```
model – The name of your model (e.g. Product)
--model-path – Relative path to your model directory (default: Models)

```

### What it does:

[](#what-it-does)

```
Checks if the given model exists in the specified path
Creates:
    ProductRepository.php in app/Repositories
    ProductRepositoryInterface.php in app/Repositories/Interfaces
    Adds boilerplate CRUD methods

```

3. Generate Service Class for Repository
----------------------------------------

[](#3-generate-service-class-for-repository)

Options:

```
repository – The name of your repository/model (e.g. Product)
--repository-path – Relative path to your repositories (default: Repositories)

```

### What it does:

[](#what-it-does-1)

```
    Checks if the repository and interface exist
    Creates a service class in app/Services
    Injects the interface in the constructor
    Adds methods: getAll, getById, create, update, delete

```

4. Generate Service Class for Model
-----------------------------------

[](#4-generate-service-class-for-model)

```
php artisan larastruct:make-service {model} --model-path=Models

```

Options:

```
model – The name of your model (e.g. Product)
--model-path – Relative path to your model directory (default: Models)

```

What it does:

```
Checks if the model exists
Creates a service class in app/Services
Injects the model in the constructor
Adds basic methods like getAll, getById, create, update, delete

```

Example Output
--------------

[](#example-output)

### ProductRepository

[](#productrepository)

```
class ProductRepository
{
    public function all() { ... }
    public function find($id) { ... }
    public function create(array $data) { ... }
    public function update($id, array $data) { ... }
    public function delete($id) { ... }
}

```

Let's improve it together
-------------------------

[](#lets-improve-it-together)

Would you like to improve this tool or add new features? Feel free to fork and submit a PR. Let’s make LaraStructor even cooler together

Author(s)
---------

[](#authors)

- [@lokeshrangani](https://www.github.com/lokeshrangani)
- waiting for yourname

###  Health Score

16

—

LowBetter than 5% of packages

Maintenance40

Moderate activity, may be stable

Popularity4

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity14

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/e9d273a4f1c88e9ddfbb95efabdd5b6b1542d3392e27b96d81f25494fad6336c?d=identicon)[lokeshrangani](/maintainers/lokeshrangani)

---

Top Contributors

[![lokeshrangani](https://avatars.githubusercontent.com/u/57695393?v=4)](https://github.com/lokeshrangani "lokeshrangani (3 commits)")

---

Tags

code-structurelaravel-applicationlaravel-templatelaravel-template-masteringscaffold-templatescaffoldingtemplate-project

### Embed Badge

![Health badge](/badges/laralearn-larastructor/health.svg)

```
[![Health](https://phpackages.com/badges/laralearn-larastructor/health.svg)](https://phpackages.com/packages/laralearn-larastructor)
```

PHPackages © 2026

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