How To Build Your Own PHP Composer Package

A couple of months back, I wrote a PHP library that abstracts the API of Paystack (A Nigerian FinTech company) into a pluggable composer package. The library has since gotten more than 100 installs, and another package is dependent on it. Since then, a host of other payment systems/providers and other services have popped up, so I thought to write this tutorial or guide to building your own composer installable composer package. So, off we go. Directory Structure The first thing to do is to create the directory that holds your package. It is also where you will develop the package from. Usually, the basic directory structure for PHP packages looks like; The parent_directory holds all the files of the package. The src (short for source) directory holds the package codes, the tests directory holds the package’s tests, composer.json describes your package. readme.md contains the information about your package, forming ...(Read More)

Loading Extra Files In Chrome Extensions

Many times when building chrome extensions, we’ve often found ourselves in situations where we have to add extra html to the web page. One way is to add the html on directly in the content_script js file, but I personally prefer not mixing up html and js in the same file. Also depending on the amount of html needed, it’s just be better to create a new html file for that purpose and then find a way to bring it into the content script. To do this, first we need to create the file and then add it to our manifest file as a web accessible resource. This allows the file to be usable in the context of a web page. Next if the file uses extra javascript or css files, we can add those in the content_script tag of our manifest file. This allows the css/js file be loaded ...(Read More)

Integrating mabiola/paystack-php-lib In Your PHP Projects – 1

A few weeks ago, I released a PHP Library or as one of my colleagues will call it, an SDK, for easily integrating Paystack in your PHP projects. This is the first of a series of posts that will explain as simply as possible, how to use the library in your projects. Througout this series, we will be working with vanila PHP (A PHP project with no framework) so as not to restrict ourselves to a particular “box”. In this first post, we’ll be setting up the sample project and doing the most basic operation you can do with Paystack – recieving payment from a client. So to have a general idea of what we will be working on, we will create an order page, and when the user fills in their information and click a pay button, we redirect them to an authorization URL to provide their card details ...(Read More)