PHP code example of snowfire / snowfire-app

1. Go to this page and download the library: Download snowfire/snowfire-app 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/ */

    

snowfire / snowfire-app example snippets


if ($request->header('User-Agent') == 'Snowfire')
{
	return $next($request);
}

return [
	'id' => 'demo_app',
	'name' => 'Demo app',
	'tab' => 'admin',
	'actions' => [
		'events' => 'action.events.index',
		'event' => 'action.events.show',
	]
];


// Admin routes
Route::group(['prefix' => 'admin/{snowfireAppId}', 'before' => 'snowfireAppAuth', 'namespace' => 'Admin'], function()
{
	Route::get('/', ['as' => 'admin.index', function($appId)
    {
        return 'Admin for appId: ' . $appId;
    }]);

});

// Action routes
Route::group(['namespace' => 'Action'], function()
{
	Route::get('events', ['uses' => 'EventsController@index', 'as' => 'action.events.index']);
	Route::get('events/{id}', ['uses' => 'EventsController@event', 'as' => 'action.events.show']);
});