2017 © Pedro Peláez
 

library laravel-jmespath

jmespath.php service provider for Laravel 5

image

libtek/laravel-jmespath

jmespath.php service provider for Laravel 5

  • Friday, November 27, 2015
  • by libtek
  • Repository
  • 1 Watchers
  • 0 Stars
  • 321 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

laravel-jmespath

A Laravel 5 wrapper for use of the jmespath.php library. The jmespath.php library is an implementation of the JMESPath specification., (*1)

This package also provides Artisan commands to pre-compile and manage your JMESPath expressions., (*2)

Installation

Install through composer

$ composer require libtek/laravel-jmespath

Add Service Provider

In config/app.php, add the service provider to the $providers array:, (*3)

'providers' => [
    // ...
    Libtek\Jmes\JmesServiceProvider::class,
],

Add alias

In config/app.php, add the facade to the $aliases array:, (*4)

'aliases' => [
    // ...
    'Jmes' => Libtek\Jmes\Facades\Jmes::class,
],

Publish the configuration file

If you'd like to modify the default configuration values or define expressions to pre-compile, publish the package config file:, (*5)

php artisan vendor:publish --provider="Libtek\Jmes\JmesServiceProvider"

This will create a jmes.php file in your config directory., (*6)

Usage

With facade:

$result = Jmes::search($expression, $data);

Helper function:

$result = jmes($expression, $data);

Artisan commands

Two Artisan commands are available with the package:, (*7)

jmes:compile

This compiles and caches JMESPath expressions. Expressions can be sourced in multiple ways:, (*8)

  1. Running the command with no options or arguments will look for expressions in the jmes.php config file:, (*9)

    php artisan jmes:compile
    
  2. Passing a single expression to the command:, (*10)

    php artisan jmes:compile 'foo.*.baz'
    
  3. Setting the -c or --cli option will prompt for expressions to be added manually:, (*11)

    php artisan jmes:compile --cli
    
     Please enter a JMESPath expression:
     > foo.*.baz
    

jmes:clear

This will delete any previously compiled expressions:, (*12)

php artisan jmes:clear

Pass -h or --help to either command to view its usage., (*13)

The Versions

27/11 2015

dev-master

9999999-dev

jmespath.php service provider for Laravel 5

  Sources   Download

MIT

The Requires

 

by Ben Tischler

laravel jmespath jmes