orkan / utils

Bunch of scripts collected from all around the HDD

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Utils v3.10.0

Bunch of scripts collected from all around the HDD

Console app

src/Application.php

Simple, configurable, extendable, easy to use CLI app implementation.

Usage

// 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' ) );

See included tools in /bin dir for more examples.

FORM Input generator

src/Input.php

HTML/PHP <form> input parser. Allows automatic import of values form POST like data arrays with value filtering. Allows rendering html input elements straight from php array.

Usage

Define:

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

Parse:

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
}

Thumbnail generator

src/Thumbnail.php

@todo Add description...

PHP cli apps

  • bin/app_env_switch.php - Switch between multiple configuration files.
  • bin/app_files_quantity.php - Copy files from one dir to another with quantity limit and sorting features.

About

Requirements

  • Main:
    • PHP ^7
  • Tools:
    • ANT ^1.9.4
    • DOS
    • Eclipse
    • MySQL

Third Party Packages

  • none

Installation

$ composer require orkan/utils

Author

Orkan

Updated

Tue, 04 Apr 2023 15:44:31 +02:00

About

Bunch of scripts collected from all around the HDD

License:MIT License


Languages

Language:PHP 92.0%Language:Batchfile 7.6%Language:VBScript 0.4%