This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.

m22760
m22760

I'm pretty new to October, but it's looking useful. I'm testing it by migrating an existing Laravel project (in order to make it easier for the client to manage). I originally installed using the Installer Wizard (as it's described as the 'recommended way'), so I don't have a composer.json in root.

I'm now trying to develop a plugin locally and need to include some packages. I've created a composer.json in my plugin folder and run composer install which has downloaded the packages into a vendor folder.

But how do I correctly reference these packages in my plugin? I've added use references to the packages, but I'm getting Class not found errors. I think i'm missing a step here, but I don't know what it is.

Any help is much appreciated.

EDIT: I've followed the instructions to add composer to a Wizard Installed instance. Now I can run composer update from the project root to update my plugin's dependencies.

But I still can't figure out the correct path to the classes to use.

Last updated

taha.azzabi14703
taha.azzabi14703

Hi, For example let’s add this package “Dingo Api” for our plugin October Cms https://github.com/dingo/api.

As I see you’ve already have composer, 1) Start by installing the package: in route plugin folder command line type:

 composer require dingo/api:1.0.x@dev.

2) Publish the configuration package: In October Cms Root :

php artisan vendor:publish --provider="Dingo\Api\Provider\LaravelServiceProvider"

3) Register the required service provider

Open the file Plugin.php in your root plugin folder

The in the register function:

public function register(){

        $this->app->register(\Dingo\Api\Provider\LaravelServiceProvider::class);
    }

[link text itself] Dingo/API implementation for OctoberCMS

https://github.com/jonathandey/oc-jd-dingoapi

m22760
m22760

Thanks...

It was the last step: adding the service provider that I was missing.

Working now!

1-3 of 3

You cannot edit posts or make replies: the forum has moved to talk.octobercms.com.