{"id":15657396,"url":"https://github.com/juffalow/slim-graphql-eloquent-example","last_synced_at":"2025-05-05T15:44:02.915Z","repository":{"id":46759724,"uuid":"146029676","full_name":"juffalow/slim-graphql-eloquent-example","owner":"juffalow","description":"Example project how to use Slim, GraphQL and Eloquent","archived":false,"fork":false,"pushed_at":"2025-01-08T23:46:21.000Z","size":167,"stargazers_count":24,"open_issues_count":3,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-30T22:05:45.977Z","etag":null,"topics":["eloquent","example-project","graphql","php","phpstan","phpunit","slim"],"latest_commit_sha":null,"homepage":"https://graphql.juffalow.com/","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/juffalow.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-08-24T19:02:36.000Z","updated_at":"2025-01-29T21:08:12.000Z","dependencies_parsed_at":"2025-03-09T19:41:50.965Z","dependency_job_id":null,"html_url":"https://github.com/juffalow/slim-graphql-eloquent-example","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/juffalow%2Fslim-graphql-eloquent-example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/juffalow%2Fslim-graphql-eloquent-example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/juffalow%2Fslim-graphql-eloquent-example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/juffalow%2Fslim-graphql-eloquent-example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/juffalow","download_url":"https://codeload.github.com/juffalow/slim-graphql-eloquent-example/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252525528,"owners_count":21762313,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["eloquent","example-project","graphql","php","phpstan","phpunit","slim"],"created_at":"2024-10-03T13:06:42.299Z","updated_at":"2025-05-05T15:44:02.874Z","avatar_url":"https://github.com/juffalow.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Slim, GraphQL and Eloquent example\n\n[![License](https://img.shields.io/badge/License-MIT-blue.svg?maxAge=2592000)](https://github.com/juffalow/slim-graphql-eloquent-example/blob/master/LICENSE)\n[![codecov](https://codecov.io/gh/juffalow/slim-graphql-eloquent-example/branch/master/graph/badge.svg)](https://codecov.io/gh/juffalow/slim-graphql-eloquent-example)\n\n## How to run the project\n\nInstall dependencies :\n\n```shell\ncomposer install\n```\n\nCreate database for the project by importing *eloquent_example.sql* and update the *config/config.php*:\n\n```php\n\u003c?php\n\nreturn [\n  'settings' =\u003e [\n    'displayErrorDetails' =\u003e true,\n    'db' =\u003e [\n      'driver' =\u003e 'mysql',\n      'host' =\u003e 'localhost',\n      'database' =\u003e 'eloquent_example',\n      'username' =\u003e 'root',\n      'password' =\u003e '',\n      'charset'   =\u003e 'utf8',\n      'collation' =\u003e 'utf8_unicode_ci',\n      'prefix'    =\u003e '',\n      'unix_socket' =\u003e '/Applications/XAMPP/xamppfiles/var/mysql/mysql.sock',\n    ]\n  ],\n];\n\n```\n\nRun the project :\n\n```shell\nphp -S localhost:8088\n```\n\n## Logging\n\nThere are multiple ways how to setup logging. The application now supports\nrotating file logging and slack logging.\n\nLogging levels:\n* DEBUG (100)\n* INFO (200)\n* NOTICE(250)\n* WARNING (300)\n* ERROR (400)\n* CRITICAL (500)\n* ALERT(550)\n* EMERGENCY (600)\n\nRotating file:\n\n```php\n  ...\n  'log' =\u003e [\n    'file' =\u003e [\n      'level' =\u003e 100,\n      'file' =\u003e 'path/to/file',\n    ]\n  ],\n  ...\n```\n\n## Debug\n\nGraphQL debug modes:\n* INCLUDE_DEBUG_MESSAGE (1)\n* INCLUDE_TRACE(2)\n* RETHROW_INTERNAL_EXCEPTIONS (4)\n\n```php\n  ...\n  'graphql' =\u003e [\n    'debug' =\u003e INCLUDE_DEBUG_MESSAGE | INCLUDE_TRACE,\n  ],\n  ...\n```\n\n## Security\n\n[Limiting Query Depth](https://webonyx.github.io/graphql-php/security/#limiting-query-depth):\n\n```php\n  ...\n  'graphql' =\u003e [\n    'maxDepth' =\u003e 10,\n  ],\n  ...\n```\n\n[Introspection](https://webonyx.github.io/graphql-php/security/#disabling-introspection):\n\n```php\n  ...\n  'graphql' =\u003e [\n    'introspection' =\u003e true,\n  ],\n  ...\n```\n\n## Examples\n\n### Queries\n\n#### Get list of authors\n\n```graphql\nquery {\n  authors {\n    edges {\n      node {\n        id\n        _id\n        firstName\n        lastName\n      }\n    }\n  }\n}\n```\n\n#### Filter authors by first name\n\n```graphql\nquery {\n  authors(firstName: \"John\") {\n    edges {\n      node {\n        id\n        _id\n        firstName\n        lastName\n      }\n    }\n  }\n}\n```\n\n#### Order authors by first name and last name:\n\n```graphql\nquery {\n  authors(orderBy:[\n    {\n      field:FIRST_NAME\n      direction:ASC\n    }\n    {\n      field:LAST_NAME\n      direction:ASC\n    }\n  ]) {\n    edges {\n      cursor\n      node {\n        _id\n        firstName\n        lastName\n      }\n    }\n  }\n}\n```\n\n### Mutations\n\n#### Create new author\n\n```graphql\nmutation {\n  createAuthor(input:{firstName:\"Fredrick\", lastName:\"Brooks\"}) {\n    id\n    _id\n    firstName\n    lastName\n  }\n}\n```\n\n## Tests\n\nRun PHPUnit:\n\n```shell\n./vendor/bin/phpunit\n\n# or\n\n./vendor/bin/phpunit --bootstrap ./vendor/autoload.php --testdox tests\n```\n\nUse PHP Stan to analyse php files for basic errors:\n\n```shell\n./vendor/bin/phpstan analyse src\n```\n\n## License\n\n[MIT license](./LICENSE)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjuffalow%2Fslim-graphql-eloquent-example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjuffalow%2Fslim-graphql-eloquent-example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjuffalow%2Fslim-graphql-eloquent-example/lists"}