PHPackages                             getpop/application - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. getpop/application

ActiveLibrary[API Development](/categories/api)

getpop/application
==================

Create a component-based application

1.0.6(2y ago)17583GPL-2.0-or-laterPHPPHP ^8.1CI failing

Since Jan 25Pushed 2y ago1 watchersCompare

[ Source](https://github.com/getpop/application)[ Packagist](https://packagist.org/packages/getpop/application)[ Docs](https://github.com/getpop/application)[ RSS](/packages/getpop-application/feed)WikiDiscussions master Synced 3d ago

READMEChangelogDependencies (8)Versions (39)Used By (3)

Application
===========

[](#application)

Create a component-based website

Install
-------

[](#install)

Via Composer

```
composer require getpop/application
```

Development
-----------

[](#development)

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

Usage
-----

[](#usage)

Initialize the component:

```
\PoP\Root\App::stockAndInitializeModuleClasses([([
    \PoP\Application\Module::class,
]);
```

Main Concepts
-------------

[](#main-concepts)

### Multidomain

[](#multidomain)

PoP has been built to support decentralization: modules can fetch their data from a different domain/subdomain from which the application is hosted. For instance, an application can have its components retrieved from subdomains:

[![Modules can have their data fetched from different domains and subdomains](https://camo.githubusercontent.com/9817f461c1302d38b73c5203e8d2f1d3d8c143841817aab58071e55aea63cfe3/68747470733a2f2f75706c6f6164732e676574706f702e6f72672f77702d636f6e74656e742f75706c6f6164732f323031372f30322f6170706c69636174696f6e2d776972656672616d652e706e67)](https://camo.githubusercontent.com/9817f461c1302d38b73c5203e8d2f1d3d8c143841817aab58071e55aea63cfe3/68747470733a2f2f75706c6f6164732e676574706f702e6f72672f77702d636f6e74656e742f75706c6f6164732f323031372f30322f6170706c69636174696f6e2d776972656672616d652e706e67)

A single component is also able to have many sources of data, each of them coming from a different domain/subdomain. For instance, the [events calendar in SukiPoP.com](https://sukipop.com/en/calendar/) displays events from several external sites in a unique calendar, painting events with a different color according to the source domain:

[![Multidomain events calendar](https://camo.githubusercontent.com/ba2cb34b8068a78909ccd9b9424093fdc482cee3ab3923202e92f872dd786ac3/68747470733a2f2f75706c6f6164732e676574706f702e6f72672f77702d636f6e74656e742f75706c6f6164732f323031382f31322f6d756c7469646f6d61696e2d6576656e74732d63616c656e6461722e706e67)](https://camo.githubusercontent.com/ba2cb34b8068a78909ccd9b9424093fdc482cee3ab3923202e92f872dd786ac3/68747470733a2f2f75706c6f6164732e676574706f702e6f72672f77702d636f6e74656e742f75706c6f6164732f323031382f31322f6d756c7469646f6d61696e2d6576656e74732d63616c656e6461722e706e67)

Architecture Design and Implementation
--------------------------------------

[](#architecture-design-and-implementation)

### Dataloading

[](#dataloading)

#### Lazy-Loading

[](#lazy-loading)

We can instruct a dataloading module to be lazy-loaded (i.e. instead of fetching its database data immediately, it is fetched on a subsequent request from the client) simply by setting its prop `"lazy-load"` to `true`:

```
function initModelProps($component, &$props)
{
  switch ($component->name) {
    case self::COMPONENT_AUTHORARTICLES:

      // Set the content lazy
      $this->setProp($component, $props, 'lazy-load', true);
      break;
  }

  parent::initModelProps($component, $props);
}
```

Being a prop, this value can be set either by the dataloading module itself, or by any of its ancestor modules:

```
function initModelProps($component, &$props)
{
  switch ($component->name) {
    case self::COMPONENT_AUTHORARTICLESWRAPPER:

      // Set the content lazy
      $this->setProp([COMPONENT_AUTHORARTICLES], $props, 'lazy-load', true);
      break;
  }

  parent::initModelProps($component, $props);
}
```

Among others, the following are several uses cases for lazy-loading the data for a module:

- Modules which are displayed on several pages (eg: a "latest posts" widget on a sidebar) can have its data cached in the client (eg: through Service Workers, localStorage, etc) and, by lazy-loading, this data is not fetched again on the server on each request
- Fetching data from a different domain
- Improve apparent loading speed by lazy-loading data for below-the-fold modules (eg: a post's comments)
- Fetching data with user state on a page without user state ([as outlined here](https://www.smashingmagazine.com/2018/12/caching-smartly-gutenberg/))

### Multidomain

[](#multidomain-1)

By default, a module will fetch its data from the domain where the application is hosted. To change this to a different domain(s) or subdomain(s) is done by setting prop `"dataload-multidomain-sources"` on the module:

```
function initModelProps($component, &$props) {

  switch ($component->name) {
    case self::COMPONENT_SOMENAME:

      $this->setProp(
        $component,
        $props,
        'dataload-multidomain-sources',
        'https://anotherdomain.com'
      );
      break;
  }

  parent::initModelProps($component, $props);
}
```

We can also pass an array of domains, in which case the module will fetch its data from all of them:

```
function initModelProps($component, &$props) {

  switch ($component->name) {
    case self::COMPONENT_SOMENAME:

      $this->setProp(
        $component,
        $props,
        'dataload-multidomain-sources',
        array(
          'https://anotherdomain1.com',
          'https://subdomain.anotherdomain2.com',
          'https://www.anotherdomain3.com',
        );
      break;
  }

  parent::initModelProps($component, $props);
}
```

When fetching data from several sources, each source will keep its own state in the [QueryInputOutputHandler](#queryhandler). Then, it is able to query different amounts of data from different domains (eg: 3 results from domain1.com and 6 results from domain2.com), and stop querying from a particular domain when it has no more results.

Because the external application may have different components installed, it is not guaranteed that fetching data from the external application by simply adding `?output=json` will bring the data required by the origin application. To solve this issue, when querying data from an external application, PoP will use the [custom-querying API](#Custom-Querying-API) to fetch exactly the required data fields (this works for fetching database data, not configuration). If we have control on the external application and we can guarantee that both sites have the same components installed, then we can define constant `EXTERNAL_SITES_RUN_SAME_SOFTWARE` as true, which will allow to fetch database and configuration data through the regular `?output=json` request.

---

---

---

PHP versions
------------

[](#php-versions)

Requirements:

- PHP 8.1+ for development
- PHP 7.2+ for production

### Supported PHP features

[](#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.2

[](#preview-downgrade-to-php-72)

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

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

Standards
---------

[](#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:

```
composer check-style
```

To automatically fix issues, run:

```
composer fix-style
```

Change log
----------

[](#change-log)

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

Testing
-------

[](#testing)

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

```
composer test
```

Static Analysis
---------------

[](#static-analysis)

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

```
composer analyse
```

Report issues
-------------

[](#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
------------

[](#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
--------

[](#security)

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

Credits
-------

[](#credits)

- [Leonardo Losoviz](https://github.com/leoloso)
- [All Contributors](../../../../../../contributors)

License
-------

[](#license)

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

###  Health Score

34

—

LowBetter than 77% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity16

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity74

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~26 days

Recently: every ~0 days

Total

38

Last Release

981d ago

Major Versions

0.10.2 → 1.0.02023-09-06

PHP version history (3 changes)0.7.6PHP ^7.4|^8.0

0.8.1PHP ^8.0

0.9.0PHP ^8.1

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/1981996?v=4)[Leonardo Losoviz](/maintainers/leoloso)[@leoloso](https://github.com/leoloso)

![](https://www.gravatar.com/avatar/d5a0a064bae63a335ddd796bb69ab38e1d01420d14bfcc8e3d4e1550922ac60b?d=identicon)[getpop](/maintainers/getpop)

---

Top Contributors

[![leoloso](https://avatars.githubusercontent.com/u/1981996?v=4)](https://github.com/leoloso "leoloso (352 commits)")

---

Tags

phpgraphqlapplicationGatoGatoGraphQL

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan, Rector

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/getpop-application/health.svg)

```
[![Health](https://phpackages.com/badges/getpop-application/health.svg)](https://phpackages.com/packages/getpop-application)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
