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)

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)