PHPackages                             moeen-basra/photon - 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. [Framework](/categories/framework)
4. /
5. moeen-basra/photon

ActiveLibrary[Framework](/categories/framework)

moeen-basra/photon
==================

Laravel micro framework for SRP (Single Responsibility Principle)

1.0.0(2y ago)3181[4 PRs](https://github.com/moeen-basra/photon/pulls)MITPHPPHP ^8.1

Since Feb 3Pushed 1y ago3 watchersCompare

[ Source](https://github.com/moeen-basra/photon)[ Packagist](https://packagist.org/packages/moeen-basra/photon)[ RSS](/packages/moeen-basra-photon/feed)WikiDiscussions main Synced today

READMEChangelog (8)Dependencies (2)Versions (18)Used By (0)

Photon
======

[](#photon)

[![License](https://camo.githubusercontent.com/08cef40a9105b6526ca22088bc514fbfdbc9aac1ddbf8d4e6c750e3a88a44dca/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4d49542d626c75652e737667)](LICENSE)

Photon is a lightweight extension framework for Laravel that implements the Single Responsibility Principle (SRP) design pattern. It draws inspiration from the [Lucid Framework](https://docs.lucidarch.dev/installation).

How to Use
----------

[](#how-to-use)

To use Photon in your Laravel project, follow these steps:

1. Open your terminal and execute the following command:

```
composer require moeen-basra/photon
```

2. Open the `App\Http\Controllers\Controller` class and replace the following code:

```
use Illuminate\Routing\Controller as BaseController;
```

with:

```
use MoeenBasra\Photon\Http\Controller as BaseController;
```

3. Extend the `app\Exceptions\Handler` class with the following class:

```
MoeenBasra\Photon\Foundation\Exceptions\Handler\Handler
```

Alternatively, you can use the following traits in your existing exception handler:

```
use MoeenBasra\Photon\Concerns\Marshal;
use MoeenBasra\Photon\Concerns\ActionRunner;
```

In the `render` method, execute the following job if the request accepts `application\json`:

```
$message = $exception->getMessage();
$code = $exception->getCode();
$errors = ($exception instanceof \Illuminate\Validation\ValidationException) ? $exception->errors() : [];

if ($request->expectsJson()) {
    return $this->run(JsonErrorResponseJob::class, [
        'message' => $message,
        'errors' => $errors,
        'status' => ($code < 100 || $code >= 600) ? 400 : $code,
    ]);
}
```

4. Create the following directories inside the `app` folder:

```
|-- app
|  |-- Actions
|  |-- Features
|  |-- Operations

```

5. Here's an example code for a controller that serves the feature:

```
namespace App\Http\Controllers\Api\Auth;

use App\Features\Api\Auth\RegisterFeature;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
use MoeenBasra\Photon\Http\Controller;

class AuthController extends Controller
{
    public function __construct()
    {
        $this->middleware('auth:api', ['only' => ['me', 'logout']]);
    }

    public function register(Request $request): JsonResponse
    {
        return $this->serve(RegisterFeature::class, [
            'data' => $request->validated(),
        ]);
    }
}
```

6. Lastly, here's an example code for a feature that runs the job:

```
namespace App\Features\Api\Auth;

use App\Operations\Auth\RegisterOperation;
use Illuminate\Http\JsonResponse;
use Photon\Actions\JsonResponseAction;
use MoeenBasra\Photon\Features\Feature;

final class RegisterFeature extends Feature
{
    public function __construct(
        readonly private array $input
    ){}

    public function handle(): JsonResponse
    {
        $data = $this->run(RegisterOperation::class, [
            'input' => $this->input
        ]);

        return $this->run(new JsonResponseAction($data));
    }
}
```

License
-------

[](#license)

Photon is released under the [MIT License](https://opensource.org/licenses/MIT). See the [LICENSE](LICENSE) file for details.

Contact
-------

[](#contact)

You can reach me here

###  Health Score

36

—

LowBetter than 82% of packages

Maintenance31

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity78

Established project with proven stability

 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.

###  Release Activity

Cadence

Every ~200 days

Recently: every ~299 days

Total

9

Last Release

1030d ago

Major Versions

v0.5.2 → 1.0.02023-07-16

PHP version history (5 changes)0.1.1PHP &gt;=7.1.3

v0.2.0PHP &gt;=7.2

v0.4.0PHP ^7.2

v0.5.0PHP ^8.0

1.0.0PHP ^8.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/29e85434bbb62af31bbfe18c0983fd39f14e472995e53ecfab734258fd470b9b?d=identicon)[moeen-basra](/maintainers/moeen-basra)

---

Top Contributors

[![moeen-basra](https://avatars.githubusercontent.com/u/3841052?v=4)](https://github.com/moeen-basra "moeen-basra (7 commits)")

---

Tags

laravelphotonSRP

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/moeen-basra-photon/health.svg)

```
[![Health](https://phpackages.com/badges/moeen-basra-photon/health.svg)](https://phpackages.com/packages/moeen-basra-photon)
```

###  Alternatives

[hemp/presenter

Easy Model Presenters in Laravel

247592.6k1](/packages/hemp-presenter)[rahulalam31/laravel-abuse-ip

Block ip address of all spammer's around the world.

27431.5k](/packages/rahulalam31-laravel-abuse-ip)[laravel-frontend-presets/black-dashboard

Laravel 11.x Front-end preset for black dashboard

8726.2k](/packages/laravel-frontend-presets-black-dashboard)

PHPackages © 2026

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