Download the PHP package zeeloengineering/php-shared-kernel without Composer

On this page you can find all versions of the php package zeeloengineering/php-shared-kernel. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package php-shared-kernel

Shared kernel

Simple shared kernel for DDD applications, with many scaffolding code for Hexagonal architecture, event sourcing, etc.

Entities

You can create a new entity just inheriting from Entity class:

Implementing constructor is mandatory as Id is controlled from base class.

As far as you have inherited from Entity, you have an EventStreamAvailable, so you can record events and retrieve the EventStream:

Entity collections

As you are eventually going to return arrays of entities from your repositories, I have prepared a simple entity collection for you to inherit:

DomainEvents

You have a base class DomainEvent to inherit from when you want to create an Event. As simple as that:

UseCase

A very simple way to access Domain and Infrastructure layers from your console commands or controllers is through an Application UseCase. A UseCase receives a Request and may return (or null) a Response. Let's see an example:

Probably you have noted the DataTransformer object. It provides functionality to transform any object into any other in the application layer. This means you can use the same UseCase to retrieve information in different formats just injecting a different data transformer. This is basic to not return domain objects to the infrastructure layer.

I recommend defining your use cases with different names based in the data transformer you inject. For example:

This can be easily done if you use a decent dependency injector.

CQRS

CQRS stands for Command Query Responsibility Segregation and basically means that a method should either return a value of modify it's context, never both things at the same time.

I have provided with some useful interfaces to work both with Commands (to change context) and Queries (to retrieve information). This is used to be done through command and query buses. A bus accepts some kind of request (a Command or a Query) and processes it through a handler (a CommandHandler or a QueryHandler). Middlewares can be added along the process.

So in the namespace StraTDeS\SharedKernel\Application\CQRS you have abstract classes for both Command and Query, and interfaces for both CommandHandler and QueryHandler.

Repositories

There are some useful interfaces to implement repositories, including get, find, all interface and save interface. Apart, I have included two basic doctrine repositories, DoctrineRepository and DoctrinePersistentRepository. You can use it to have some features for free:


All versions of php-shared-kernel with dependencies

PHP Build Version
Package Version
Requires ramsey/uuid Version ^3.7
doctrine/orm Version ^2.5
php-amqplib/php-amqplib Version ^2.7
guzzlehttp/guzzle Version ^6.3
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package zeeloengineering/php-shared-kernel contains the following files

Collapse All

src

   Application

     CQRS
     UseCase
    DataTransformer.php
    GenericApplicationException.php

   Domain

     Criteria
    GenerableId.php
    Repository.php
    ReadModelRepository.php
    PersistentRepository.php
    PersistentReadModelRepository.php
    PageableCollection.php
    Id.php
    GenericDomainException.php
    EventStore.php
    EventStream.php
    EventSourcedRepositoryInterface.php
    EventSourcedEntity.php
    EventApplierMethodNotDefinedException.php
    EntityNotFoundException.php
    EntityCollection.php
    Entity.php
    DomainEvent.php
    UUIDV4.php

   Infrastructure

     Criteria
     Doctrine
       CustomType
    QueueAdapterConfigProviderInterface.php
    RabbitMQQueueAdapter.php
    QueueTimeoutException.php
    QueueRuntimeException.php
    QueueMessage.php
    QueueAdapterInterface.php
    GenericInfrastructureException.php
    GuzzleAPIRestClient.php
    EnvVarsQueueAdapterConfigProvider.php
    DoctrineReadModelRepository.php
    DoctrinePersistentRepository.php
    DoctrinePersistentReadModelRepository.php
    APIRestClientInterface.php
    RepositoryException.php

tests

   Unit

     Domain
.gitignore
LICENSE
README.md
composer.json
composer.lock
phpunit.xml