PHP code example of orkan / utils

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

    

orkan / utils example snippets


// Define app config and modules
$Factory = new Factory([
	'app_title'   => 'My CLI app',
]);

// Initialize PHP env, load cmd line switches, set error handlers, etc...
$App = new Application( $Factory );
$App->run();

// Do something!
$Factory->Logger()->notice( 'Hello from ' . $Factory->get( 'app_title' ) );

$fields = [
	'text' => [
		'type'   => 'text',
		'filter' => 'strtoupper',
	],
	'radios' => [
		'type'   => 'radio',
		'defval' => 'radC',
		'items'  => [
			'radA' => 'Tag A',
			'radB' => 'Tag B',
			'radC' => 'Tag C',
		],
	],
];

foreach ( $fields as $name => $field ) {
	$Input = new Input( $field, $_POST ); // Create Input with value extracted from POST array
	saveDB( $name, $Input->val() ); // Save filtered value to DB
	echo $Input->getContents(); // Render element on HTML page
}