This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.
lucas.sanner54070
In my plugin I need a helper class which gather some common functions I can call from anywhere.
I had a look at the way to do that with Laravel, but I wasn't sure that it fits to an October plugin context.
So this is what I've done so far:
I put my helper file in a helpers directory: helpers/MyHelper.php
<?php namespace CompanyName\MyPlugin\Helpers;
use October\Rain\Support\Traits\Singleton;
class MyHelper
{
use Singleton;
public function myFunction()
{
...
}
...
}
and to use it
use CompanyName\MyPlugin\Helpers\MyHelper;
...
MyHelper::instance()->myFunction();
Now I have 2 questions:
1) Is this the proper way to use a helper in an October plugin ?
2) How can I autoload the helper class ?
1-1 of 1