Download the PHP package ziming/laravel-myinfo-sg without Composer
On this page you can find all versions of the php package ziming/laravel-myinfo-sg. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download ziming/laravel-myinfo-sg
More information about ziming/laravel-myinfo-sg
Files in ziming/laravel-myinfo-sg
Package laravel-myinfo-sg
Short Description Laravel Package for Singapore MyInfo
License
Homepage https://github.com/ziming/laravel-myinfo-sg
Informations about the package laravel-myinfo-sg
Laravel MyInfo Singapore
A working PHP Laravel Package for MyInfo Singapore. With the annoying, time wasting hidden quirks of implementing it in PHP figured out.
Will the new Myinfo be supported?
Yes, it is in my plans, previously I did not support Myinfo v4 as they announced that a new version will come out
Recently the new version is out in November 2024 and sites on Myinfo v3 are given 6 months to upgrade.
As usual, my other work & personal life commitments will come 1st but I will still try to get it out before Myinfo v3 expires
If anyone wants to make a PR before my own attempt, you are welcome to do so too
Hope that helps for those who emailed me.
Installation
You can install the package via composer:
Followed by adding the following variables to your .env
file.
The values provided below are the ones provided in the official MyInfo nodejs tutorial.
Change them to the values you are given for your app.
Lastly, publish the config file
You may also wish to publish the MyInfo official nodejs demo app ssl files as well to storage/myinfo-ssl. You should replace these in your production environment.
Usage and Customisations
When building your button to redirect to SingPass. It should link to route('myinfo.singpass')
After SingPass redirects back to your Callback URI, you should make a post request to route('myinfo.person')
If you prefer to not use the default routes provided you may set enable_default_myinfo_routes
to false
in
config/laravel-myinfo-sg.php
and map your own routes. This package controllers will still be accessible as shown
in the example below:
During the entire execution, some exceptions may be thrown. If you do not like the format of the json responses.
You can customise it by intercepting them in your laravel application app/Exceptions/Handler.php
An example is shown below:
The list of exceptions are as follows
Lastly, if you prefer to write your own controllers, you may make use of LaravelMyinfoSgFacade
or LaravelMyinfoSg
to generate the
authorisation api uri (The redirect to Singpass link) and to fetch MyInfo Person Data. Examples are shown below
You may also choose to subclass GetMyinfoPersonDataController
and override its preResponseHook()
template method to
do logging or other stuffs before returning the person data.
Changelog
Please see CHANGELOG for more information what has changed recently.
Contributing
A donation is always welcomed (currently $0), especially if you or your employer makes money with the help of my packages. Which I am aware of a couple.
All versions of laravel-myinfo-sg with dependencies
ext-gmp Version *
ext-json Version *
ext-openssl Version *
archtechx/enums Version ^1.0
guzzlehttp/guzzle Version ^7.0
illuminate/contracts Version ^11.0
spatie/laravel-package-tools Version ^1.16.6
web-token/jwt-framework Version ^4.0