PHP Libraries

Violet PHP Library Collection

The Violet PHP Library collection attempts to solve some common PHP problems with high quality libraries while following modern standards of code quality and best practices in the PHP community. There are no strict set of standards for what constitutes as high quality code as a tools and practices are constantly evolving and thus the goal is to adhere to always what is current and modern.

Streaming JSON Encoder

The Streaming JSON Encoder library provides classes for encoding large JSON documents in a streaming manner rather than trying to encode the entire document in the memory at once. The main advantage of this library is to allow encoding large data sets that may consume too much memory to encode in a single function call.

Kit Library Collection

The Kit Library collection provides several general purpose libraries with the intention of providing high quality code with full test coverage. PHPUnit 100% test coverage and Scrutinizer code quality of 10 were used as the main metrics. Some of these libraries were created as curiosities or learning projects, so some of them have less use than others.


The BaseConversion library provides classes to convert number from arbitrary number base to another arbitrary number base. This library supports numbers of arbitrary size in addition to number base with arbitrary characters or character sequences representing the numbers.


The ClassLoader library provides a class autoloader that supports PSR-0 and PSR-4 based autoloading. While the library does not offer much features beyond standard Composer autoloader, it may in come corner cases be used as an alternative to composer, if it is not available for some reason.


The CSRF library provides secure classes for implementing CSRF tokens to protect against cross site request forgery attacks. The library tries to make it easy to implement secure CSRF verification while using random tokens for each request to mitigate against BREACH attacks while trying to avoid any user inconvenience.


The PathJoin library provides functions for joining and normalizing file paths in a platform agnostic way using string manipulation. Essentially the library allows expanding of "." and ".." in file paths to produce normalized complete paths while allowing both "\" and "/" as directory separators.


The PHPEncoder library is for exporting PHP variables into PHP code similar to the php function var_export(). Compared to the built in function, however, this library provides more options to customize the style of the output in order to generate more readable PHP code or more compact cache files.


The SecureRandom library provides convenience for working with secure random generators. The library provides mostly optimized functions for doing random array and string operations based on available sources of secure randomness.


The UrlParser library provides PSR-7 compatible classes for handling and parsing URLs. The library relies fully on the RFC 3986 for validating URIs and implements it's own custom url parser that is more accurate compared to the parse_url() function provided by PHP.

Simply Framework

The Simply Framework is a collection of libraries that is part of an experimental framework. The overarching goal of the framework is to create a framework based on existing PSR standards while minimizing the bootstrap time during requests and encouraging a predictable architecture that is easy to maintain.


The Application package provides a bare bones structure for a middleware based web application. The application layer takes advantage of the PSR-7, PSR-11, PSR-15 and PSR-17 standards (namely, the HTTP Message/Handler/Factory standards in addition to the container standard).

Database Convenience Layer

The Database Convenience Layer is a partial database abstraction layer and an object relation mapper. The purpose of the database layer is to make is easier to do common database operation while still being able to rely on plain SQL queries to make database workloads more efficient.

Dependency Injection Container

The Dependency Injection Container package provides a container that is compatible with the PSR-11 container interface standard. The main idea behind the package is to enable creation of cached prebuilt containers that are quick to initialize and take full advantage of opcache's immutable arrays.

Request Router

The Router package provides a way to map specific URL paths to specific request handlers while additionally parsing specific parameters from the url itself. The router is based on separating paths to different segments and matching those rather than building large regular expression which makes everything a bit simple and also faster in some specific cases.