andikaryanto11 / ci4graphql
ORM Database mapping for Codeigniter 4
v0.0.5
2021-08-06 04:12 UTC
Requires
- php: ^7.4
- webonyx/graphql-php: ^14.9
README
This package is created to create graphql in ci4
Install
composer require andikaryanto11/ci4graphql
Usage
-
Create Controller Class then Extends to this AndikGraphql\Controller\GraphQL
-
in ci4 route file add this line AndikGraphql\Route\GraphqlRoute:routes($routes, 'YOUR_CONTROLLER::function')
-
create directory under app called 'Graphql' (all your graphql work will be inside here).
-
Resolver class must extends AndikGraphql\LogicResolver then should have function with name public function reveal({root}, {args}, {context})
-
in QueryResolver / MutationResolver class, you must register your mutation / query like
public function register() { $this->queries = [ 'getTest' => new Test(), ]; return $this; }
-
take a look at the example directory, the example directory structure looks like code igniter 4 to make it easy to understand