Installation

Introduction

You can use the Streams Platform as a basis for Laravel projects and leverage it's features just like PyroCMS does.

Before proceeding consider starting your project with a vanilla PyroCMS installation and remove unneeded addons. You can also fork PyroCMS and change the composer.json to fit your businesses needs for projects.

The Streams Platform comes setup and ready right out of the box with PyroCMS.{.notice}

Installation

Download with Composer

First download the package by running composer require anomaly/streams-platform.

Register the service provider

Next you need to register the service provider with Laravel. To do this add the following service provider to the end of the providers section in config/app.php just as you would any other Laravel package:

<?php

return [

    // ...

    'providers' => [

        // ...
        
        Anomaly\Streams\Platform\StreamsServiceProvider::class,
    ],


];

Modify the public/index.php file

Next you need to modify the public/index.php file to use the kernels provided by the Streams Platform. This simply overrides the HTTP kernel with a variant designed to deliver HTTP cache. This is a required change.

$kernel = $app->make(Illuminate\Contracts\Http\Kernel::class);
$kernel = \Anomaly\Streams\Platform\Http\CacheKernel::wrap($kernel);

$response = $kernel->handle(
    $request = Illuminate\Http\Request::capture()
);

$response->send();

$kernel->terminate($request, $response);

Modify the bootstrap/app.php file

The Streams Platform adds low level functionality to the HTTP and console kernels. In order for this to work properly you must register the kernels provided by the Streams Platform in the bootstrap/app.php file:

$app->singleton(
    Illuminate\Contracts\Http\Kernel::class,
    'Anomaly\Streams\Platform\Http\Kernel'
);

$app->singleton(
    Illuminate\Contracts\Console\Kernel::class,
    'Anomaly\Streams\Platform\Console\Kernel'
);

Run Streams Installer

Lastly you will need to run the install which will install the database tables.

php artisan install

Configure Users

Your user object must implement Anomaly\Streams\Platform\User\Contract\UserInterface in order to ensure compatibility.

Configure your users provider in config/auth.php. If you are using the Users Module you can use the below configuration:

<?php

return [
  
    // ...
    
    'providers' => [
        'users' => [
            'driver' => 'eloquent',
            'model'  => Anomaly\UsersModule\User\UserModel::class,
        ],
    ],
];

Configure the Guest Role

You must set an instance of Anomaly\Streams\Platform\User\Contract\RoleInterface on the \Anomaly\Streams\Platform\Support\Authorizer singleton.

The guest role is responsible for authorizing non-logged in users.

public function register(Authorizer $authorizer) {
    $authorizer->setGuest(new GuestRole());
}