Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/graphqlbypop/graphql-server

[READ ONLY] CMS-agnostic GraphQL server in PHP
https://github.com/graphqlbypop/graphql-server

api graphql php pop server

Last synced: 23 days ago
JSON representation

[READ ONLY] CMS-agnostic GraphQL server in PHP

Awesome Lists containing this project

README

        

# GraphQL server

GraphQL server in PHP, implemented through the PoP API

## Install

### Installing the GraphQL server

Follow the instructions in the [GraphQL by PoP installation page](https://graphql-by-pop.com/docs/getting-started/installation/).

### Installing the library in a PoP application

Via Composer

``` bash
composer require graphql-by-pop/graphql-server
```

To enable pretty API endpoint `/api/graphql/`, follow the instructions [here](https://github.com/PoP-PoPAPI/api#enable-pretty-permalinks)

## Development

The source code is hosted on the [GatoGraphQL monorepo](https://github.com/GatoGraphQL/GatoGraphQL), under [`GraphQLByPoP/packages/graphql-server`](https://github.com/GatoGraphQL/GatoGraphQL/tree/master/layers/GraphQLByPoP/packages/graphql-server).

## Usage

Initialize the component:

``` php
\PoP\Root\App::stockAndInitializeModuleClasses([([
\GraphQLByPoP\GraphQLServer\Module::class,
]);
```

## Support for REST

By installing the [REST package](https://github.com/PoP-PoPAPI/api-rest), the GraphQL server can also satisfy REST endpoints, from a single source of truth.

## Demo

The GraphQL API (running on top of [a WordPress site](https://newapi.getpop.org)) is deployed under this endpoint: https://newapi.getpop.org/api/graphql/

You can play with it through the following clients:

- GraphiQL: https://newapi.getpop.org/graphiql/
- GraphQL Voyager: https://newapi.getpop.org/graphql-interactive/

## PHP versions

Requirements:

- PHP 8.1+ for development
- PHP 7.4+ for production

### Supported PHP features

Check the list of [Supported PHP features in `GatoGraphQL/GatoGraphQL`](https://github.com/GatoGraphQL/GatoGraphQL/blob/master/docs/supported-php-features.md)

### Preview downgrade to PHP 7.4

Via [Rector](https://github.com/rectorphp/rector) (dry-run mode):

```bash
composer preview-code-downgrade
```

## Standards

[PSR-1](https://www.php-fig.org/psr/psr-1), [PSR-4](https://www.php-fig.org/psr/psr-4) and [PSR-12](https://www.php-fig.org/psr/psr-12).

To check the coding standards via [PHP CodeSniffer](https://github.com/squizlabs/PHP_CodeSniffer), run:

``` bash
composer check-style
```

To automatically fix issues, run:

``` bash
composer fix-style
```

## Change log

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

## Testing

To execute [PHPUnit](https://phpunit.de/), run:

``` bash
composer test
```

## Static Analysis

To execute [PHPStan](https://github.com/phpstan/phpstan), run:

``` bash
composer analyse
```

## Report issues

To report a bug or request a new feature please do it on the [GatoGraphQL monorepo issue tracker](https://github.com/GatoGraphQL/GatoGraphQL/issues).

## Contributing

We welcome contributions for this package on the [GatoGraphQL monorepo](https://github.com/GatoGraphQL/GatoGraphQL) (where the source code for this package is hosted).

Please see [CONTRIBUTING](CONTRIBUTING.md) and [CODE_OF_CONDUCT](CODE_OF_CONDUCT.md) for details.

## Security

If you discover any security related issues, please email [email protected] instead of using the issue tracker.

## Credits

- [Leonardo Losoviz][link-author]
- [All Contributors][link-contributors]

## License

GNU General Public License v2 (or later). Please see [License File](LICENSE.md) for more information.

[ico-version]: https://img.shields.io/packagist/v/graphql-by-pop/graphql-server.svg?style=flat-square
[ico-license]: https://img.shields.io/badge/license-GPLv2-brightgreen.svg?style=flat-square
[ico-travis]: https://img.shields.io/travis/graphql-by-pop/graphql-server/master.svg?style=flat-square
[ico-scrutinizer]: https://img.shields.io/scrutinizer/coverage/g/graphql-by-pop/graphql-server.svg?style=flat-square
[ico-code-quality]: https://img.shields.io/scrutinizer/g/graphql-by-pop/graphql-server.svg?style=flat-square
[ico-downloads]: https://img.shields.io/packagist/dt/graphql-by-pop/graphql-server.svg?style=flat-square

[link-packagist]: https://packagist.org/packages/graphql-by-pop/graphql-server
[link-travis]: https://travis-ci.org/graphql-by-pop/graphql-server
[link-scrutinizer]: https://scrutinizer-ci.com/g/graphql-by-pop/graphql-server/code-structure
[link-code-quality]: https://scrutinizer-ci.com/g/graphql-by-pop/graphql-server
[link-downloads]: https://packagist.org/packages/graphql-by-pop/graphql-server
[link-author]: https://github.com/leoloso
[link-contributors]: ../../../../../../contributors