Cartalyst LLC.
Support by Cartalyst
1
8
0
14
76

Introduction

A support package that provides flexible and reusable helper methods and traits for commonly used functionalities.

The package requires PHP 8.0+ and follows the FIG standard PSR-4 to ensure a high level of interoperability between shared PHP code and is fully unit-tested.

Have a read through the Installation Guide.

Installation

The best and easiest way to install the Support package is with Composer.

Preparation

Open your composer.json file and add the following to the require array:

"cartalyst/support": "^6.0"

Note: Make sure that after the required changes your composer.json file is valid by running composer validate.

Install the dependencies

Run Composer to install or update the new requirement.

php composer install

or

php composer update

Now you are able to require the vendor/autoload.php file to autoload the package.

Usage

In this section we'll show how you can make use of the available traits.

EventTrait

The EventTrait makes it easy to add dispatching abilities to your classes.

use Cartalyst\Support\Traits\EventTrait;

class FooRepository
{
    use EventTrait;

    public function foo()
    {
        $this->fireEvent('foo');
    }
}

RepositoryTrait

The RepositoryTrait makes it easy to create new instances of a model and to retrieve or override the model during runtime.

use Cartalyst\Support\Traits\RepositoryTrait;

class FooRepository
{
    use RepositoryTrait;

    public function foo()
    {
        return $this->createModel();
    }
}

You wont find fancy lifestyle graphics and marketing bravado here. Just cold... hard... code...

Code Well, Rock On!
Processing Payment...