nodesol / laraql
This is my package laraql
Fund package maintenance!
Requires
- php: ^8.2|^8.3|^8.4|^8.5
- illuminate/contracts: ^10.0|^11.0|^12.0|^13.0
- mll-lab/graphql-php-scalars: ^6.4
- nuwave/lighthouse: ^6.66
- spatie/laravel-package-tools: ^1.16
Requires (Dev)
- larastan/larastan: ^2.9||^3.0
- laravel/pint: ^1.14
- mll-lab/laravel-graphiql: ^3.3
- nunomaduro/collision: ^8.1.1||^7.10.0
- orchestra/testbench: ^10.0.0||^9.0.0||^8.22.0
- pestphp/pest: ^2.34|^3.0
- pestphp/pest-plugin-arch: ^2.0|^3.0
- pestphp/pest-plugin-laravel: ^2.0|^3.0
- phpstan/extension-installer: ^1.3||^2.0
- phpstan/phpstan-deprecation-rules: ^1.1||^2.0
- phpstan/phpstan-phpunit: ^1.3||^2.0
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
Laravel, meet GraphQL.
LaraQL enables you to effortlessly integrate GraphQL into your Laravel application using native PHP attributes. Published in 2025 for modern developer workflows.
LaraQL uses Code-First Discovery. Instead of maintaining a separate .graphql file, your PHP classes become the source of truth. LaraQL scans these classes and generates the SDL for Lighthouse on the fly.
Documentation
https://nodesol.github.io/laraql
Installation
Use composer to add LaraQL to your Laravel project:
composer require nodesol/laraql
Publish the default configuration to customize scan paths.
php artisan vendor:publish --tag="laraql-schema"
Usage
The #[Model()] attribute tells LaraQL that this class should be part of the GraphQL schema. LaraQL will automatically generate the necessary schema to create a Type, Input, two Queries (single/multiple), and Mutations (create/update/delete).
use Nodesol\LaraQL\Attributes\Model as ModelAttribute; #[ModelAttribute()] class Article extends Model { public string $title; }
AI Agents (Laravel Boost)
LaraQL ships Laravel Boost guidelines and agent skills, so coding agents extend the schema with attributes instead of hand-written SDL.
composer require laravel/boost --dev php artisan boost:install
Boost detects nodesol/laraql and installs:
- Guidelines (always loaded): how LaraQL discovers classes, what
#[Model()]generates, and the rules around$fillable,$hidden, schema caching, database introspection and overrides. - Skills (loaded on demand):
laraql-development- models, attributes, generated CRUD, filters, overrides, authorization and schema debugging, plusreferences/attributes.mdandreferences/troubleshooting.md.laraql-scout-search- the@scoutFiltersdirective for Meilisearch search combined with Eloquentwhereconditions and pagination.
Both live in resources/boost, so you can read them or copy them into your application's .ai/guidelines and .ai/skills directories to adapt them.
Testing
The suite runs on Testbench with a workbench application in workbench that provides the models, GraphQL classes, migrations and hand-written graphql/schema.graphql the tests exercise.
composer test # run the whole suite composer test-coverage composer analyse # PHPStan composer format # Pint
The tests are split into two suites:
tests/Unit- the LaraQL attributes, the schema building listener, the column and relation type maps, and the Scout filters directive/handler.tests/Feature- the schema LaraQL generates (printed and executed), the generated queries and mutations, Scout search, authorization and the service provider behaviour.
Pest reads its configuration from testbench.yaml.dist; copy it to testbench.yaml to change the workbench set-up locally. Coverage reporting needs a driver such as PCOV or Xdebug:
vendor/bin/pest --coverage --min=100
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
License
The MIT License (MIT). Please see License File for more information.