Nasrul Hazim Bin Mohamad

Laravel: Packager


Assalamualaikum / Hi,

In this post, I will talk more about Laravel Package Generator, Packager.

And today, this morning, I just created Money Wrapper, a Money wrapper, and of course using Packager.

Before we go to the things inside Packager, here the package Money Wrapper provide:

  • Provide a Money helper – money()
  • Intended for Laravel Framework, but can be use outside from Laravel Framework as well.
  • Provide common usage such as:
    1. For Human Readability – RM 1.00, RM 345.00
    2. For Common Display – 1.00, 345.00
    3. For Machine (intended format to store in Database – integer) – 100, 34500
    4. Fixed Exchange Rate Conversion – $ 1 > RM 3.87

So, that’s just briefly about the package, you may go ahead to Money Wrapper to start use it.

Package Skeleton

First thing first, I’ve already give a short update about Packager, a Laravel Package Generator – help to speed up setup Laravel package skeleton.

The command to create new package is simple:

$ packager skeleton "Cleanique Coders" "Demo Package"

Following are the sample package generated:

Package Skeleton Generated

And other than generate the skeleton for you, it’s also install all the dependencies and initialise git! Fuh! Save lot time!!

The Skeleton Details

Files and Directories

As you can see, composer(including lock), LICENSE.txt, phpunit.xml, files included in the package.

Then the structure of having src, tests and vendor already in place.


Taking a bit deeper into src directory, we have the Facade and Service Provider. This is by default generated by the package. Come along in the directory is Support directory, which usually in the directory we have a helper file – which already auto loaded during package initialisation! Very helpful!


Next, as for tests, the tests directory already setup and have a default TestCase.php, which our main file. This TestCase.php, we should extend from it when creating new test(make sure to have the suffix Test.php of the file name – you may change in phpunit.xml if you wanted to). TestCase.php also already load up your package service provider – so you don’t need to worry setting up migration. I would probably add some other setup like database settings to use SQLite in future.

I’ve also added Code Dungeon, PHPUnit Result Printer and Orchestra TestBench which both would be helpful in your test development for Laravel package.


As the conclusion, you might experienced (if you already have previously write packages), where you have missed out one or two things, or even, kinda difficult to setup one by one for your Laravel package – this is absolutely a solution for you!

For me, I’m bit lazy, and kinda irritate to keep on repeating setup the same thing, so I’ve decided to create the Packager!

And for me again, if i’m not satisfied with what’s exist, I’ll build it myself (of course with Allah’s will, insyaAllah).

When there’s a will and efforts, there’s always a result.

Hope this Packager, will help more people to learn not just about creating Laravel package, also, build a good structure and standard across Laravel packages. I did study how Laravel packages available setup, including those from Spatie, and many more. So this is the result.

Hint: Will add up for updates on Packager. Stay tuned!

AWS: S3 – Upload File


Assalamualaikum / Hi,

Just a simple note on how to upload file(s) to AWS S3. First time working with AWS S3 – it’s not my account, but you get the idea how simple it is. 🙂

Laravel: Activation Account by E-mail – Part 2


Continue from previous post, next we going to setup the middleware in order to check either the user already activate the account or not.

If user already activate the account, allow to enter our application, else redirect to request for another activation e-mail.

Laravel: Activation Account by E-mail – Part 1


From previous post, we extend the usage of Notifications, Event and Listener to have a mechanism where user need to activate their account in order to use the application.

In this Part 1, we just setup the Notification, Event and Listener. Part 2 will be about how do we check if user already activate their account or not.

Laravel: Create Welcome Email


A quick post on how to setup a welcome email on user registration.

Make sure you have a account for testing purpose, or production you may use SparkPost, or GMail SMTP, or any provider should work with proper .env on mail configuration.

Laravel: Billplz Helper


Billplz is a simple cash solution to send bills and collect payments in real-time.

There’s already a package available for PHP.

We going to create a wrapper and helper for Laravel application for the Billplz.

First, create a config file for Billplz – config/billplz.php

Then create a utility class in app/Utilities directory:

Lastly, create a helper in app/Support directory named helpers.php, and add the following command.

Now you’re done setting up your Billplz helper. You just need to setup BILLPLZ_API_KEY and BILLPLZ_VERSION in your .env to start use the Billplz helper.

Following are some example of the usage:

Billplz also provide sandbox for you to test. Do refer Billplz API documentation for more details.