Giter Site home page Giter Site logo

emyu01 / nuban Goto Github PK

View Code? Open in Web Editor NEW
12.0 2.0 4.0 19 KB

A PHP/laravel package for validating and generating nigerian nuban account numbers based on the revised CBN guidelines 2020

PHP 100.00%
banks nuban account cbn deposit-money-banks nigeria php

nuban's Introduction

Nigeria Uniform Bank Account Number (NUBAN)

This is an easy to use PHP package to help businesses to verify and generate NUBAN numbers for any Nigerian financial institution in accordance with the CBN revised standard 2020.

There are two categories of financial institutions, Deposit Money Banks (DMB) with 3 digit bank code, and Other Financial Institutions (OFI) with 5 digit bank code. The account number to validate must be 10 digits, while serial number for account number generation must be 9 digits.

Installation

To install this package, using your terminal interface, go to your project directory by running

'cd ~/your/project/directory'

To confirm present directory, run

'pwd'

Download the package using composer by running

'composer require emyu/nuban'

How to use

There are two use cases for this package. 'Validation' and 'Generation'

Validation

Follow these steps to validate an account number.

Get a valid bank code (DMB or OFI) and an account number you wish to verify belonging to the bank.

Import the Nuban class using the 'use Emyu/Nuban/Nuban'

Call the Nuban class with it's static method as 'Nuban::validate($bankCode, $accountNumber)' to validate your account number.

It returns 'Valid' if account number is correct and belongs to the bank with the code. Returns 'Invalid' otherwise.

    use Emyu\Nuban\Nuban;

    class ExampleClass {

        public $bankCode = '011';

        public $accountNumber = '0000014579';

        function exampleFunction($bankCode, $accountNumber){

           // validate a Deposit Money Bank account number
           $status = Nuban::validate($bankCode, $accountNumber);

           // value of $status = 'Valid'
        }
    }

Generation

Follow these steps to generate an account number.

Get a valid bank code (DMB or OFI) and a 9 digit serial number you wish to use as an account number.

Import the Nuban class using the 'use Emyu/Nuban/Nuban'

Call the Nuban class with it's static method as 'Nuban::generate($bankCode, $serialNumber)' to generate a valid account number.

It returns valid account number for the bank with the code if bank code is valid. Throws an error message if otherwise.

    use Emyu\Nuban\Nuban;

    class ExampleClass {

        public $bankCode = '011';

        public $serialNumber = '000001457';

        function exampleFunction($bankCode, $serialNumber){

           // generate a Deposit Money Bank account number
           $accountNumber = Nuban::generate($bankCode, $serialNumber);

           // value of $accountNumber = '0000014579'
        }
    }

Incoming features

  • Get bank name from a NUBAN number
  • Support for more financial institutions
  • Ability to input bank alias in place of bank code
  • much more

Want to Contribute?

  • Create an issue or

  • Make a fork of this repository

  • Create a new branch on your repository.

  • Make contributions on that branch.

  • Add tests for new features.

  • Commit your changes and Push.

  • Make a pull request to the base branch. VOILA!!

Love this package?

Please star this repo.

Follow me on Twitter for more updates!

nuban's People

Contributors

deepsourcebot avatar emyu01 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

nuban's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.