PHPackages                             esanj/app-service - 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. esanj/app-service

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

esanj/app-service
=================

The AppService package facilitates external service connection based on client ID.

v0.0.19(3mo ago)049MITPHPPHP ^8.2|^8.3|^8.4

Since Jul 29Pushed 2mo agoCompare

[ Source](https://github.com/eSanjDev/ms-package-app-service)[ Packagist](https://packagist.org/packages/esanj/app-service)[ RSS](/packages/esanj-app-service/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (2)Versions (14)Used By (0)

Esanj App Service
=================

[](#esanj-app-service)

The **App Service** package is part of the Esanj microservice ecosystem.
It provides centralized management, permission handling, and connectivity between different services in your Laravel-based projects.

---

🧩 Features
----------

[](#-features)

- Service registration, listing, updating, and deletion via UI or API.
- Permission management per service.
- Extendable configuration to add custom fields and permissions.
- Built-in middleware for permission checks.
- Works seamlessly with **esanj/managers** and **esanj/layout-master** packages.

---

⚙️ Requirements
---------------

[](#️-requirements)

- **PHP**: &gt;= 8.2
- **Laravel**: &gt;= 12.x
- Dependencies:
    - `esanj/managers`
    - `esanj/layout-master`

---

🚀 Installation
--------------

[](#-installation)

Run the following commands in your Laravel project:

#### Step 1:

[](#step-1)

```
composer require esanj/app-service
```

#### Step 2:

[](#step-2)

```
php artisan app-service:install
```

The install command will automatically publish static assets and configuration files.

---

🖥️ UI Usage
-----------

[](#️-ui-usage)

After installation, you can access the service management interface via:

Route name: `route('services.index')`

Direct URL: `/{web_prefix}/services`

From this interface, you can:

- View the list of services
- Create new services
- Edit existing services
- Delete services

🔗 API Endpoints
---------------

[](#-api-endpoints)

The package also exposes a set of RESTful API endpoints for managing services.

All API requests must include a valid token, which can be obtained via the Manager package.

MethodURIDescription / Behavior**GET**`/{prefix}/services`List all services**POST**`/{prefix}/services`Create a new service**PUT**`/{prefix}/services/{id}`Update an existing service**DELETE**`/{prefix}/services/{id}`Delete a service---

🧠 Configuration
---------------

[](#-configuration)

You can extend the service edit page by adding extra fields.

Simply include the path to your custom Blade components inside the configuration file:

```
'extra_fields' => [
    'page.contents.price.',
],
```

🔐 Service Permissions
---------------------

[](#-service-permissions)

Define service-specific permissions in your configuration file as follows:

```
'service_permissions' => [
     'transactions.list' => [
         'display_name' => 'List Transactions',
         'description'  => 'Allows viewing the list of all transactions for the service',
     ],
     'transactions.view' => [
         'display_name' => 'View Transaction Details',
         'description'  => 'Allows viewing detailed information of a single transaction',
     ],
     'transactions.create' => [
         'display_name' => 'Create Transaction',
         'description'  => 'Allows creating new transactions within the service',
     ],
     'transactions.update' => [
         'display_name' => 'Update Transaction',
         'description'  => 'Allows updating existing transaction information for the service',
     ],
     'transactions.delete' => [
        'display_name' => 'Delete Transaction',
        'description'  => 'Allows deleting transactions from the service',
     ],
],
```

Then, run the following command to import permissions into the database:

```
php artisan app-service:permissions-import
```

⚡ Middleware Permission Check
-----------------------------

[](#-middleware-permission-check)

To check a service’s permissions, use the built-in middleware:

```
service.permission:{permission}
```

If the service does not have the required permission, an appropriate error response will be returned.

Example:

```
Route::get('/transactions', [TransactionController::class, 'index'])->middleware('service.permission:transactions.list');
```

🧩 Middleware Token Validation
-----------------------------

[](#-middleware-token-validation)

The middleware with alias `service.validation` is used to validate incoming JWT tokens.

If the token is valid, its `client_id` value will be attached to the request as the attribute `jwt_client_id`.

If the token is invalid or expired, an appropriate error response with status code 401 Unauthorized will be returned.

Example:

```
Route::get('/transactions', [TransactionController::class, 'index'])
->middleware(['service.validation', 'service.permission:transactions.list']);
```

The Authorization header must contain the token in the format:Bearer {token}

On successful validation, the middleware extracts the client\_id from the token payload and attaches it to the request object.

If the token is missing, invalid, or expired, a JSON response with an error message and HTTP 401 status is returned.

🌐 API-Only Mode
---------------

[](#-api-only-mode)

If your project only uses APIs and has no need for the UI, you can enable API-only mode by setting:

```
'just_api' => env('APP_SERVICE_JUST_API', false)
```

This disables all UI routes while keeping the full API functionality intact.

🪪 License
---------

[](#-license)

This package is part of the Esanj ecosystem and is intended for internal or authorized use within Esanj-based projects.

###  Health Score

39

—

LowBetter than 86% of packages

Maintenance83

Actively maintained with recent releases

Popularity8

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity51

Maturing project, gaining track record

 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 ~17 days

Recently: every ~24 days

Total

13

Last Release

91d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/c908dfdf092a072c4bc678b161b053e20d00f90e9e9ba2c18ecddef6b848f1a4?d=identicon)[esanj](/maintainers/esanj)

---

Top Contributors

[![itsalifadaei](https://avatars.githubusercontent.com/u/34383343?v=4)](https://github.com/itsalifadaei "itsalifadaei (60 commits)")

### Embed Badge

![Health badge](/badges/esanj-app-service/health.svg)

```
[![Health](https://phpackages.com/badges/esanj-app-service/health.svg)](https://phpackages.com/packages/esanj-app-service)
```

###  Alternatives

[barryvdh/laravel-ide-helper

Laravel IDE Helper, generates correct PHPDocs for all Facade classes, to improve auto-completion.

14.9k123.0M687](/packages/barryvdh-laravel-ide-helper)[orchestra/canvas

Code Generators for Laravel Applications and Packages

21017.2M158](/packages/orchestra-canvas)[illuminate/pipeline

The Illuminate Pipeline package.

9446.6M213](/packages/illuminate-pipeline)[illuminate/pagination

The Illuminate Pagination package.

10532.5M862](/packages/illuminate-pagination)[spatie/laravel-pjax

A pjax middleware for Laravel 5

513371.8k11](/packages/spatie-laravel-pjax)[spatie/laravel-mix-preload

Add preload and prefetch links based your Mix manifest

169176.0k2](/packages/spatie-laravel-mix-preload)

PHPackages © 2026

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