Skip to content
master
Switch branches/tags
Go to file
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 

README.md

definition-interop services discovery POC (aka Harmony packages)

This repository contains a proof of concept for Harmony packages usage. Harmony packages are:

  • packages that define entries compatible with definition-interop
  • packages that make these definitions automatically discoverable by the main application using Puli

What does this repository do?

This repository is used to test the whole architecture for Harmony packages.

We are including one Harmony package: thecodingmachine/doctrine-cache-harmony. This package provides a Doctrine Cache service (as a YML file).

The YML file is automatically detected by the Yaml definition loader, using Puli.

The Yaml definition loader provides a definition provider that is it itself automatically detected by Yaco, using its Puli discovery factory.

Yaco is a compiler. It will compile the definitions on the fly (the first time the application is accessed), and generate a PHP class (a container).

Finally, the generated container itself is automatically detected by a composite container factory that aggregates any PSR-11 container in the application. In this demo app, there is only one container so this step is completely optional.

To sum this:

Composite container >> Yaco >> YAML Definition Loader >> service.yml

The result

This repository contains a simple test.php file. This test.php creates an instance of the (composite) container, and fetches the doctrine.cache entry. On the first run, the container is generated (.yaco/Container.php). On the other runs, the generated container is directly used (maximum performance!)

Finally, if other dependencies are added in the composer.json, a custom Puli plugin is triggered that will delete the Yaco old container (no need to purge the container manually).

Try it yourself!

Simply run:

$ composer install
$ php test.php

You should get a var_dump from the Doctrine cache service.

About

A proof of concept for definition interop packages with auto discovery (aka Harmony packages)

Resources

Releases

No releases published

Packages

No packages published

Languages