2017 © Pedro Peláez
 

library resolver

A Minimal PHP Resolver that Works!

image

gigaai/resolver

A Minimal PHP Resolver that Works!

  • Wednesday, July 25, 2018
  • by tanng
  • Repository
  • 1 Watchers
  • 0 Stars
  • 4 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

Giga AI Resolver

A Minimal PHP Resolver That Works!, (*1)

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., (*2)

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., (*3)

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

LightKit

LightKit uses resolver to let people define their controllers with Laravel syntax., (*4)

<?php

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).
    }
}

Usage

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

composer require gigaai/resolver
  1. Then you need to require 'vendor/autoload.php', (*6)

  2. Create $resolver instance, (*7)

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

// or

$resolver->bind([
    'id' => 1,
    'request' => $_REQUEST
])->resolve('function_name');

The Versions

25/07 2018

dev-master

9999999-dev

A Minimal PHP Resolver that Works!

  Sources   Download

MIT

The Requires

  • php >=5.6

 

php resolver