Serviceprovider where we register plugin service like pdf , api those we run later into hooks . Most of the service call from extensions / Module folder.
-
Create a folder into serviceProvider
-
See into app folder / Backend folder
-
Register a class and class dependency into service provider class ( https://prnt.sc/NZVCW91Gg0G6 ) and https://prnt.sc/vDem2F8gpfUe
-
Provide method use for alias
-
call this service from where in app into hook using container() function https://prnt.sc/LRooCFad2xKz
$provider = mangocube_app()->get(Some_Service_Controller::class); $mangocube_Notice = mangocube_app()->get(Mangocube_Notice::class); $mangocube_Notice->run();
we can use two type of configuration files (ARRAY , JSON) .
- Create a file into configs folder tools.php
- must return array https://prnt.sc/2WuFWuh96mRS
To get config data use mangocube_container('configs-dashboard'); function Here config is constant / Prefix See screenshoot https://prnt.sc/k1i5y8qCuxfb
mangocube_container('configs-dashboard');
-
Create a module folder in extensions https://prnt.sc/rP9HohcR0Aq8
-
Create a Init.php File and extend extension class
namespace Mangocube\extensions\menu; use Mangocube\base\Extension; final class Init extends Extension { /** * Store all the classes inside an array * @return array Full list of classes */ public static function get_services() { return [ Help::class, ]; }
}
3.1 Create a class with register method
3.2 put the class in to get_service into Above Init.php
3.3 Must Impplement runner class
namespace Mangocube\extensions\menu;
use Mangocube\base\Runner;
final class Help extends Runner
{
/**
* Store all the classes inside an array
* @return array Full list of classes
*/
public function register()
{
// Do anything here
//dump(__METHOD__);
}
}