PHPackages                             adeel3330/graphql-helper-laravel - 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. [API Development](/categories/api)
4. /
5. adeel3330/graphql-helper-laravel

ActiveLibrary[API Development](/categories/api)

adeel3330/graphql-helper-laravel
================================

Lightweight GraphQL helper layer for Laravel with validation, resolver structure, and response formatting.

v1.2.2(2mo ago)03MITPHPPHP ^8.3.27 | ^8.4 | ^8.5

Since Mar 31Pushed 2mo agoCompare

[ Source](https://github.com/Adeel3330/graphql-helper-laravel)[ Packagist](https://packagist.org/packages/adeel3330/graphql-helper-laravel)[ RSS](/packages/adeel3330-graphql-helper-laravel/feed)WikiDiscussions main Synced 3w ago

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

Laravel GraphQL Helper
======================

[](#laravel-graphql-helper)

A lightweight helper layer for GraphQL in Laravel — focused on **validation, clean resolver structure, and consistent responses**.

> Not a GraphQL engine. Not a replacement for Lighthouse. Just clean, Laravel-style developer experience.

---

🚀 Why This Package?
-------------------

[](#-why-this-package)

Working with GraphQL in Laravel often leads to:

- ❌ No standard validation approach
- ❌ Messy resolver logic
- ❌ Inconsistent response formats

This package solves that by bringing **Laravel-like structure** to GraphQL.

---

🔥 Key Feature: `@autoResolver`
------------------------------

[](#-key-feature-autoresolver)

No more manual resolver mapping.

Instead of writing:

```
@field(resolver: "App\\GraphQL\\Resolvers\\CreateUserResolver@resolve")
```

Just use:

```
@autoResolver
```

✅ Automatically maps:

```
createUser → App\GraphQL\Resolvers\CreateUserResolver

```

---

✨ Features
----------

[](#-features)

- ✅ `@autoResolver` directive (auto maps GraphQL fields → resolvers)
- ✅ Artisan generator for resolvers
- ✅ Laravel-style validation inside resolvers
- ✅ Clean and consistent resolver structure
- ✅ Automatic directive namespace registration
- ✅ Standard response helpers
- ✅ Plug &amp; play with Lighthouse

---

📦 Installation
--------------

[](#-installation)

```
composer require yourname/laravel-graphql-helper
```

---

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

[](#️-requirements)

- PHP ^8.3 | ^8.4
- Laravel ^11 | ^12 | ^13
- Lighthouse GraphQL package

---

⚙️ Usage
--------

[](#️-usage)

### 🔹 1. Create a Resolver

[](#-1-create-a-resolver)

```
php artisan make:graphql-resolver CreateUser
```

---

### 🔹 2. Resolver Example

[](#-2-resolver-example)

```
namespace App\GraphQL\Resolvers;

use App\Models\User;
use Adeel3330\GraphQLHelper\Base\Resolver;

class CreateUserResolver extends Resolver
{
    public function rules(): array
    {
        return [
            'email' => 'required|email',
            'password' => 'required|min:6',
        ];
    }

    public function handle($args)
    {
        return User::create($args);
    }
}
```

---

### 🔹 3. Use in GraphQL Schema

[](#-3-use-in-graphql-schema)

```
type Mutation {
    createUser(email: String!, password: String!): User @autoResolver
}
```

---

### 🔹 4. Run Mutation

[](#-4-run-mutation)

```
mutation {
  createUser(email: "test@test.com", password: "123456") {
    id
    email
  }
}
```

---

🔥 Validation (Automatic)
------------------------

[](#-validation-automatic)

No need to manually validate — it's handled before execution:

```
public function rules(): array
{
    return [
        'email' => 'required|email',
    ];
}
```

---

📊 Standard Responses
--------------------

[](#-standard-responses)

```
use Adeel3330\GraphQLHelper\Support\GraphQLResponse;

return GraphQLResponse::success($data);

return GraphQLResponse::error('Something went wrong');
```

---

🔥 Example Response
------------------

[](#-example-response)

```
{
  "data": {...},
  "message": "Success",
  "status": true
}
```

---

🧠 How It Works
--------------

[](#-how-it-works)

- Reads GraphQL field name (`createUser`)
- Converts to class (`CreateUserResolver`)
- Resolves from:

```
App\GraphQL\Resolvers

```

- Executes automatically

---

⚙️ Configuration (Optional)
---------------------------

[](#️-configuration-optional)

```
// config/graphql-helper.php

return [
    'resolver_namespace' => 'App\\GraphQL\\Resolvers',
];
```

---

📁 Folder Structure
------------------

[](#-folder-structure)

```
app/
└── GraphQL/
    └── Resolvers/
        └── CreateUserResolver.php

```

---

🔌 Works With
------------

[](#-works-with)

- Lighthouse GraphQL
- Custom GraphQL implementations

---

🎯 Philosophy
------------

[](#-philosophy)

- Keep it **minimal**
- Follow **Laravel conventions**
- Improve **developer experience**
- Avoid unnecessary abstraction

---

🤝 Contributing
--------------

[](#-contributing)

PRs are welcome! Keep it simple and aligned with Laravel philosophy &amp; Xiaroo Team.

---

📄 License
---------

[](#-license)

MIT

###  Health Score

39

—

LowBetter than 85% of packages

Maintenance83

Actively maintained with recent releases

Popularity3

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity56

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

Total

5

Last Release

88d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/2ec07a5f728e21e84233fcc5a42ccee366d465c99a968f294f81c0523ee27ce9?d=identicon)[Adeel3330](/maintainers/Adeel3330)

---

Top Contributors

[![Adeel3330](https://avatars.githubusercontent.com/u/75366195?v=4)](https://github.com/Adeel3330 "Adeel3330 (10 commits)")

### Embed Badge

![Health badge](/badges/adeel3330-graphql-helper-laravel/health.svg)

```
[![Health](https://phpackages.com/badges/adeel3330-graphql-helper-laravel/health.svg)](https://phpackages.com/packages/adeel3330-graphql-helper-laravel)
```

###  Alternatives

[defstudio/telegraph

A laravel facade to interact with Telegram Bots

815320.5k3](/packages/defstudio-telegraph)[riclep/laravel-storyblok

A Laravel wrapper around the Storyblok API to provide a familiar experience for Laravel devs

6277.0k5](/packages/riclep-laravel-storyblok)[jasara/php-amzn-selling-partner-api

A fluent interface for Amazon's Selling Partner API in PHP

1348.1k1](/packages/jasara-php-amzn-selling-partner-api)[rapidez/core

Rapidez Core

1822.4k65](/packages/rapidez-core)

PHPackages © 2026

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