Download the PHP package nadirlc/utilities-framework without Composer
On this page you can find all versions of the php package nadirlc/utilities-framework. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download nadirlc/utilities-framework
More information about nadirlc/utilities-framework
Files in nadirlc/utilities-framework
Package utilities-framework
Short Description Set of Php classes providing utility functions
License GPL-3.0-or-later
Homepage https://www.pakjiddat.pk/articles/view/257/utilities-framework
Informations about the package utilities-framework
Introduction
The Utilities Framework is a set of Php libraries that provide functions such as error handling, logding, emailing, fetching web pages, script profiling, database abstraction, encryption, template engine and more. It requires Php 7.2 and above. The libraries are easy to use and can be used with custom applications and Php Frameworks
The Utilities Framework code is fully commented and compliant with the PSR-2 coding guidelines.
Features
The Utilities Framework has the following features:
-
Database Management
It provides functions for working with Databases. It consists of a Query Builder, Database Cache Manager and Database Log Manager. It also provides a Database MetaQuery Runner and Database Transaction Manager, based on PDO
-
Method Validation
This allows validating method parameter values against information in the method's Doc Block comments. This feature is provided by the Comment Manager package.
-
Error Management
It allows application errors to be displayed using html template files. The template files can be easily customized. Default template files are provided for displaying formatted error messages for the browser and the command line
-
File and Folder Management
It provides functions for fetching url contents, checking if network connection works, searching for files with a folder and copying folder contents recursively
-
Email Handling
It provides functions for sending email in plain text format and html format with file attachments. It is based on the Pear Mail library and hence supports sending email using SMTP server, Php mail function and Sendmail library
-
Log Management
It provides functions for saving and updating log data to database. It uses the PDO library for saving data and hence allows log data to be saved to all the databases that are supported by PDO
-
Template Engine
It provides a template engine that allows separating the html layout code from the data. It also allows templates to be built recursively. This means that a template can consist of one or more templates, which can contain more templates. This allows complex website layouts to be divided in to simple layout files that are automatically combined by the template engine
-
Encryption
It provides function for encrypting and decrypting data using the new LibSodium library, which is part of Php >=7.2
-
String Utilities
It provides functions for exporting data to RSS format, converting relative urls to absolute, checking if string is valid JSON, HTML or Base64 encoded and more
-
Profiler
It allows the memory usage and execution time to be measured between function calls
-
Cache Manager
It allows data to be stored in a cache. It supports memory cache and database cache
-
Authentication
It provides functions for authenticating users using http digest authentication
The following screenshot shows the error message displayed by the error handler component:
The following screenshot shows the MySQL query log displayed by the error handler component as part of the error:
Installation
-
Install using composer:
Run the command: composer require nadirlc/utilities-framework
OR
-
Download from the Utilities Framework GitHub Repository
Run the command: git clone https://github.com/nadirlc/utilities-framework.git
Usage
All components of the Utilities Framework can be accessed using factory functions. To use a feature, we need to first create an object of the relavant component. For example: UtilitiesFramework::Factory("email", $parameters);. To send an email the following code can be used:
/* The Email class requires Mail and Mail_Mime pear package */ include_once ("Mail.php"); include_once ("Mail/mime.php"); /* Change the from and to emails to your email address */ $from_email = "[email protected]"; $to_email = "[email protected]"; /** The parameters for the email object */ $parameters = array("params" => "", "backend" => "mail"); /* The Email class object is fetched */ $email = UtilitiesFramework::Factory("email", $parameters); /** The email is sent */ $is_sent = $email->SendEmail($from_email, $to_email, "Utilitiesframework Test", "<h3>test html content</h3>", null, array("file-path") ); /** If the email was sent, then information message is shown */ if ($is_sent) echo "Email was successfully sent"; else echo "Email could not be sent";
Examples
The /examples folder contains example usage for each component