/PoP

Monorepo of the PoP project, including: a server-side component model in PHP, a GraphQL server, a GraphQL API plugin for WordPress, and a website builder

Primary LanguagePHPGNU General Public License v2.0GPL-2.0

PoP

PoP

This is a monorepo containing all layers from the PoP project:

Engine:
A server-side component model in PHP.

Schema:
The definitions for data entities (posts, users, comments, etc).

API:
Packages to access the schema data through an API, including REST and GraphQL.

GraphQL by PoP:
Implementation of a CMS-agnostic GraphQL server in PHP, living in graphql-by-pop.com.

GraphQL API for WordPress:
Implementation of the CMS-agnostic GraphQL server for WordPress, involving the main plugin and extensions, and living in graphql-api.com.

Site Builder:
Packages to build a website using the component-model architecture.

Wassup:
Implementation of a PoP website for WordPress (powering MESYM and TPP Debate).

Misc:
Collection of packages, clients, and others, related to PoP or any of its layers.

Dependency graph

This is how the layers in PoP relate to each other:

Dependency graph

PHP versions

All packages in this monorepo require PHP 8.0 for development, but contain only PHP code that can be transpiled to PHP 7.1 for production.

Supported PHP features

PHP Version Features
7.1 Everything
7.2 object type

parameter type widening

Functions:Constants:
7.3 Reference assignments in list()/array destructuring => [&$a, [$b, &$c]] = $d
Except inside foreach (#4376)

Flexible Heredoc and Nowdoc syntax

Trailing commans in functions calls

set(raw)cookie accepts $option argument

Functions:Exceptions:
7.4 Typed properties

Arrow functions

Null coalescing assignment operator => ??=

Unpacking inside arrays => $nums = [3, 4]; $merged = [1, 2, ...$nums, 5];

Numeric literal separator => 1_000_000

strip_tags() with array of tag names => strip_tags($str, ['a', 'p'])

covariant return types and contravariant param types

Functions:
8.0 Union types

mixed pseudo type

static return type

::class magic constant on objects

match expressions

catch exceptions only by type

Null-safe operator

Class constructor property promotion

Trailing commas in parameter lists and closure use lists

Interfaces:
  • Stringable
Classes:
  • ValueError
  • UnhandledMatchError
Constants:
  • FILTER_VALIDATE_BOOL
Functions:

Preview downgrade to PHP 7.1

Via Rector (dry-run mode):

composer preview-code-downgrade

Lando server for the GraphQL API for WordPress

Launch a development server, with WordPress installed and the GraphQL API plugin activated, through Lando.

Please make sure you have Lando installed, with version 3.0.26 or upwards (or install it from here).

The first time, to install the server, execute:

composer build-server

From then on, to start the server, execute:

composer start-server

The site will be available under http://graphql-api.lndo.site.

To access the wp-admin:

  • User: admin
  • Password: admin

More instructions on the GraphQL API for WordPress README.

Standards

PSR-1, PSR-4 and PSR-12.

To check the coding standards via PHP CodeSniffer, run:

composer check-style

To automatically fix issues, run:

composer fix-style

Testing

To execute PHPUnit, run:

composer test

Static analysis

To execute PHPStan, run:

composer analyse

Report issues

Use the issue tracker to report a bug or request a new feature for all packages in the monorepo.

Contributing

Please see CONTRIBUTING and CODE_OF_CONDUCT for details.

Security

If you discover any security related issues, please email leo@getpop.org instead of using the issue tracker.

Credits

License

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