2017-25 © Pedro Pelåez
 

library jcode

PHP Class to enable JSON driven programmatic instructions to execute controlled php code in the backend.

image

mossengine/jcode

PHP Class to enable JSON driven programmatic instructions to execute controlled php code in the backend.

  • Wednesday, May 30, 2018
  • by brenmoss
  • Repository
  • 2 Watchers
  • 2 Stars
  • 0 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

JCode

Latest Stable Version Latest Unstable Version License composer.lock, (*1)

Build Status codecov, (*2)

Total Downloads Monthly Downloads Daily Downloads, (*3)

PHP Class to enable JSON driven programmatic instructions to execute controlled php code in the backend., (*4)

Functions

__constructor()

<?php
// Currently no constructor but one will be here soon to support limits and settings.

Installation

With Composer

$ composer require mossengine/swagabase
{
    "require": {
        "mossengine/jcode": "~1.0.0"
    }
}
<?php
// Require the autoloader, normal composer stuff
require 'vendor/autoload.php';

// Instantiate a Jcode class
$classJCode = new Mossengine\JCode\JCode;

// Execute an array of JCode directly into the class
$classJCode->execute([
    'variables' => [
        'boolResult' => false
    ],
    'instructions' => [
        [
            'type' => 'variables',
            'variables' => [
                [
                    'variable' => 'boolResult',
                    'type' => 'value',
                    'value' => true
                ]
            ]
        ]
    ]
]);

Without Composer

Why are you not using composer? Download Jcode.php from the repo and save the file into your project path somewhere. This project does not support composerless environments., (*5)

String JSON

Instead of PHP Associative Array you can also just send in JSON stringify structure and to save you the time we decode it for you., (*6)

$classJCode->executeJson('{"variables":{"boolResult":false},"instructions":[{"type":"variables","variables":[{"variable":"boolResult","type":"value","value":true}]}]}');

Getting back the results

Simply call on the variable function and define a variable key to get a specific key value back or no defined key and you will get all the variables back, (*7)

$mixedValue = $classJCode->variable('boolResult');

$arrayVariables = $classJCode->variable();

Modify variables

You can also modify variable values or define new variables by using the exact same variable function but provide a second parameter for the value you wish to assign to the variable name, (*8)

$classJCode->variable('boolResult', false);

$classJCode->variable('stringNewVariable', 'Hello Wolrd is cliché!');

$classJCode->variable(null, [
    'new' => 'array'
]);

The Versions

30/05 2018

dev-master

9999999-dev https://github.com/Mossengine/JCode

PHP Class to enable JSON driven programmatic instructions to execute controlled php code in the backend.

  Sources   Download

GPL-3.0-only

The Requires

 

The Development Requires

by Brendon Moss

json code backend execute programmatic