PHP code example of megaads / clara-app-store

1. Go to this page and download the library: Download megaads/clara-app-store library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

megaads / clara-app-store example snippets


Module::action('action_name', [params]);

@action('action_name', [params])

Module::onAction('action_name', function ($params) {  
      
}, PRIORITY);

Module::onAction('action_name', 'Modules\Example\Controllers\HomeController@action', PRIORITY);

Module::view('view_name', [params], IS_MULTI_LAYER);

Module::view('view_name', 'This is a view placeholder', IS_MULTI_LAYER);

Module::view('view_name', function() {
    return 'This is a view placeholder';
}, IS_MULTI_LAYER);

@view('view_name', [params])

Module::onView('view_name', function ($params) {  
    return view('module-namespace:home.index');
}, PRIORITY);

Module::onView('view_name', 'Modules\Example\Controllers\HomeController@index', PRIORITY);

$variable = Module::variable('handle', $default, PRIORITY);

@variable('variable_name', 'handle', $default);

Module::onVariable('hanlde', function ($params) {
}, PRIORITY, NUUM_OF_PARAM);

<script type="text/javascript" src="<?= Module::asset('{module-namespace}/js/demo.js') 

<script type="text/javascript" src="@asset('{module-namespace}/js/demo.js')"></script>

$modules = Module::all();

$module = Module::this();

$option = Module::option('option.name');

$option = Module::option('option.name', 'option.value');

php artisan vendor:publish --provider="Megaads\Clara\Providers\ModuleServiceProvider"

php artisan module:make <ModuleName> ...

app
│
└───Modules
    
    └───ModuleName
        │
        └───Config
        │      app.php
        │
        └───Controllers
        │      Controller.php
        │      ...
        │
        └───Helpers
        │      helper.php
        │      ...
        │
        └───Middlewares
        │      ExampleMiddleware.php
        │      ...
        │
        └───Models
        │      ...
        │
        └───Resources
        │      Views
        │      Assets
        │      ...
        │
        └───Routes
        │      routes.php
        │      ...
        │
        └───Kernel.php
        │
        └───module.json
        │
        └───start.php

php artisan module:install <ZipFilePath> <ZipFileURL> ...

php artisan module:enable <ModuleName> ...

php artisan module:disable <ModuleName> ...