{"id":32460500,"url":"https://github.com/pakjiddat/utilities-framework","last_synced_at":"2025-10-26T11:59:14.481Z","repository":{"id":57023222,"uuid":"174813352","full_name":"pakjiddat/Utilities-Framework","owner":"pakjiddat","description":"Set of Php classes providing utility functions","archived":false,"fork":false,"pushed_at":"2019-03-20T12:07:59.000Z","size":139,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-08-04T01:42:29.886Z","etag":null,"topics":["database-abstraction","docbloc-parser","email-sender","log-manager","template-engine","utility-classes"],"latest_commit_sha":null,"homepage":"https://pakjiddat.netlify.app/posts/utilities-framework","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pakjiddat.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-03-10T11:20:00.000Z","updated_at":"2024-09-15T10:20:25.000Z","dependencies_parsed_at":"2022-08-23T14:20:38.348Z","dependency_job_id":null,"html_url":"https://github.com/pakjiddat/Utilities-Framework","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/pakjiddat/Utilities-Framework","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pakjiddat%2FUtilities-Framework","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pakjiddat%2FUtilities-Framework/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pakjiddat%2FUtilities-Framework/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pakjiddat%2FUtilities-Framework/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pakjiddat","download_url":"https://codeload.github.com/pakjiddat/Utilities-Framework/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pakjiddat%2FUtilities-Framework/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":281099978,"owners_count":26443537,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-26T02:00:06.575Z","response_time":61,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["database-abstraction","docbloc-parser","email-sender","log-manager","template-engine","utility-classes"],"created_at":"2025-10-26T11:59:13.575Z","updated_at":"2025-10-26T11:59:14.474Z","avatar_url":"https://github.com/pakjiddat.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp\u003e\u003cimg src=\"https://www.pakjiddat.pk/pakjiddat/ui/images/code-editor.png\" alt=\"Utilities Framework\" /\u003e\u003c/p\u003e\n\n\u003ch3\u003eIntroduction\u003c/h3\u003e\n\u003cp\u003eThe 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\u003c/p\u003e\n\n\u003cp\u003eThe Utilities Framework code is fully commented and compliant with the \u003ca href='https://www.php-fig.org/psr/psr-2/'\u003ePSR-2\u003c/a\u003e coding guidelines.\u003c/p\u003e\n\n\u003ch3\u003eFeatures\u003c/h3\u003e\n\u003cp\u003eThe Utilities Framework has the following features:\u003c/p\u003e\n\u003col\u003e\n  \u003cli\u003e\n    \u003ch5\u003eDatabase Management\u003c/h5\u003e\n    \u003cp\u003eIt 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 \u003ca href='http://php.net/manual/en/book.pdo.php'\u003ePDO\u003c/a\u003e\u003c/p\u003e\n  \u003c/li\u003e\n  \u003cli\u003e\n    \u003ch5\u003eMethod Validation\u003c/h5\u003e\n    \u003cp\u003eThis allows validating method parameter values against information in the method's Doc Block comments. This feature is provided by the \u003ca href='/articles/view/254/comment-manager'\u003eComment Manager\u003c/a\u003e package.\u003c/p\u003e\n  \u003c/li\u003e\n  \u003cli\u003e\n    \u003ch5\u003eError Management\u003c/h5\u003e\n    \u003cp\u003eIt 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\u003c/p\u003e\n  \u003c/li\u003e\n  \u003cli\u003e\n    \u003ch5\u003eFile and Folder Management\u003c/h5\u003e\n    \u003cp\u003eIt provides functions for fetching url contents, checking if network connection works, searching for files with a folder and copying folder contents recursively\u003c/p\u003e\n  \u003c/li\u003e\n  \u003cli\u003e\n    \u003ch5\u003eEmail Handling\u003c/h5\u003e\n    \u003cp\u003eIt provides functions for sending email in plain text format and html format with file attachments. It is based on the \u003ca href='https://pear.php.net/package/Mail/'\u003ePear Mail\u003c/a\u003e library and hence supports sending email using SMTP server, Php mail function and Sendmail library\u003c/p\u003e\n  \u003c/li\u003e\n  \u003cli\u003e\n    \u003ch5\u003eLog Management\u003c/h5\u003e\n    \u003cp\u003eIt 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\u003c/p\u003e\n  \u003c/li\u003e\n  \u003cli\u003e\n    \u003ch5\u003eTemplate Engine\u003c/h5\u003e\n    \u003cp\u003eIt 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\u003c/p\u003e\n  \u003c/li\u003e\n  \u003cli\u003e\n    \u003ch5\u003eEncryption\u003c/h5\u003e\n    \u003cp\u003eIt provides function for encrypting and decrypting data using the new \u003ca href='http://php.net/manual/en/book.sodium.php'\u003eLibSodium library\u003c/a\u003e, which is part of Php \u003e=7.2\u003c/p\u003e\n  \u003c/li\u003e\n  \u003cli\u003e\n    \u003ch5\u003eString Utilities\u003c/h5\u003e\n    \u003cp\u003eIt 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\u003c/p\u003e\n  \u003c/li\u003e\n  \u003cli\u003e\n    \u003ch5\u003eProfiler\u003c/h5\u003e\n    \u003cp\u003eIt allows the memory usage and execution time to be measured between function calls\u003c/p\u003e\n  \u003c/li\u003e\n  \u003cli\u003e\n    \u003ch5\u003eCache Manager\u003c/h5\u003e\n    \u003cp\u003eIt allows data to be stored in a cache. It supports memory cache and database cache\u003c/p\u003e\n  \u003c/li\u003e\n  \u003cli\u003e\n    \u003ch5\u003eAuthentication\u003c/h5\u003e\n    \u003cp\u003eIt provides functions for authenticating users using http digest authentication\u003c/p\u003e\n  \u003c/li\u003e\n\u003c/ol\u003e\n\n\u003cp\u003eThe following screenshot shows the error message displayed by the error handler component:\u003c/p\u003e\n\n\u003cp\u003e\u003cimg src=\"https://www.pakjiddat.pk/pakjiddat/ui/images/error-message.png\" alt=\"Error Handler Component\" /\u003e\u003c/p\u003e\n\n\u003cp\u003eThe following screenshot shows the MySQL query log displayed by the error handler component as part of the error:\u003c/p\u003e\n\n\u003cp\u003e\u003cimg src=\"https://www.pakjiddat.pk/pakjiddat/ui/images/mysql-query-log.png\" alt=\"MySQL Query Log\" /\u003e\u003c/p\u003e\n\n\u003ch3 class=\"mb-4\"\u003eInstallation\u003c/h3\u003e\n\n\u003col\u003e\n\n\u003cli\u003e\n\u003ch5\u003eInstall using composer:\u003c/h5\u003e\n\u003cp\u003eRun the command: \u003cb\u003ecomposer require nadirlc/utilities-framework\u003c/b\u003e\u003c/p\u003e\n\u003cp\u003e\u003cb\u003eOR\u003c/b\u003e\u003c/p\u003e\n\u003c/li\u003e\n\n\u003cli\u003e\n\u003ch5\u003eDownload from the \u003ca href='https://github.com/nadirlc/utilities-framework'\u003eUtilities Framework GitHub Repository\u003c/a\u003e\u003c/h5\u003e\n\u003cp\u003eRun the command: \u003cb\u003egit clone https://github.com/nadirlc/utilities-framework.git\u003c/b\u003e\u003c/p\u003e\n\u003c/li\u003e\n\u003c/ol\u003e\n\n\u003ch3\u003eUsage\u003c/h3\u003e\n\u003cp\u003eAll 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: \u003cb\u003eUtilitiesFramework::Factory(\"email\", $parameters);\u003c/b\u003e. To send an email the following code can be used:\u003c/p\u003e\n\n\u003cpre id=\"example1\" class=\"collapse\"\u003e\u003cb\u003e\n/* The Email class requires Mail and Mail_Mime pear package */\ninclude_once (\u0026#x22;Mail.php\u0026#x22;);\ninclude_once (\u0026#x22;Mail/mime.php\u0026#x22;);\n        \n/* Change the from and to emails to your email address */\n$from_email       = \u0026#x22;nadir@dev.pakjiddat.pk\u0026#x22;;\n$to_email         = \u0026#x22;nadir@dev.pakjiddat.pk\u0026#x22;;\n/** The parameters for the email object */\n$parameters       = array(\u0026#x22;params\u0026#x22; =\u0026#x3E; \u0026#x22;\u0026#x22;, \u0026#x22;backend\u0026#x22; =\u0026#x3E; \u0026#x22;mail\u0026#x22;);\n/* The Email class object is fetched */\n$email            = UtilitiesFramework::Factory(\u0026#x22;email\u0026#x22;, $parameters);\n/** The email is sent */\n$is_sent          = $email-\u0026#x3E;SendEmail($from_email, $to_email, \u0026#x22;Utilitiesframework Test\u0026#x22;,\n                        \u0026#x22;\u0026#x3C;h3\u0026#x3E;test html content\u0026#x3C;/h3\u0026#x3E;\u0026#x22;, \n                        null,\n                        array(\u0026#x22;file-path\u0026#x22;)\n                    );\n/** If the email was sent, then information message is shown */\nif ($is_sent) echo \u0026#x22;Email was successfully sent\u0026#x22;;\nelse echo \u0026#x22;Email could not be sent\u0026#x22;;\n\u003c/b\u003e\u003c/pre\u003e\n\n\n\u003ch3\u003eExamples\u003c/h3\u003e\n\u003cp\u003eThe \u003cb\u003e/examples\u003c/b\u003e folder contains example usage for each component\u003c/p\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpakjiddat%2Futilities-framework","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpakjiddat%2Futilities-framework","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpakjiddat%2Futilities-framework/lists"}