A Minimal PHP Resolver that Works!

dev-master 2018-07-25 10:08 UTC

This package is auto-updated.

Last update: 2020-07-21 18:33:31 UTC


A Minimal PHP Resolver That Works!

Resolver makes your code easier to read, remember and use. This standalone library is minimal & fast (~1.3KB) which you can use in any project, it uses PHP ReflectionMethod and ReflectionFunction feature.

Use cases:

Giga AI Framework

Giga AI framework uses resolver to help people define callback for a node easier. You don't need to remember the position of $bot, $lead and $input variable, you can use only variable you need. The callback is flexible, backward compatibility because we can add more variable later.

$bot->answers('email', function ($bot, $lead, $input) {


LightKit uses resolver to let people define their controllers with Laravel syntax.


class SettingController extends Controller
	public function index()
		// Method that doesn't have any argument.

	public function create($request)
		// Method that take $request argument

	public function update($id, $request)
		// $request argument can be in any position (in this case, second).


Resolve steps is easy: create an instance, bind data and resolve. 0. First, like other repo, you still need to composer require:

composer require gigaai/resolver
  1. Then you need to require 'vendor/autoload.php'

  2. Create $resolver instance

$resolver = new GigaAI\Resolver\Resolver;
  1. Bind [data] and resolve [method or function]
	'id' => 1,
	'request' => $_REQUEST
])->resolve([$class, 'method']);

// or

	'id' => 1,
	'request' => $_REQUEST