vanchelo/phalcon-console

Phalcon Ajax Console

v1.0.2 2015-10-17 11:37 UTC

This package is not auto-updated.

Last update: 2024-05-11 11:05:13 UTC


README

Adapted by Phalcon https://github.com/darsain/laravel-console - Laravel 4 Console

AJAX console to execute PHP code in the browser with light, the ability to save the last code execution, limited access by IP address

Example, commissioning editor, click Execute [Ctrl + Enter]

$user = Users::findFirst(1);

echo $user->name;

Result

vanchelo

Installation

Install the latest stable version using composer:

composer require vanchelo/phalcon-console

Copy and paste:

  • Copy the contents of a folder to any directory
  • Register your autoloader namespace Vanchelo\Console
// $loader = new Loader();

$loader->registerNamespaces([
    'Vanchelo\Console' => __DIR__ . '/../library/console/src/', // The path may be different
]);
  • Copy the contents of folders in your public folder accessible from public WEB
  • Add Services
/**
 * Register Console Service
 */
new Vanchelo\Console\ConsoleService($di);
  • Add to the list of allowed IP addresses in the src/config/config.php
/* ... */
'whitelist' => [
    '127.0.0.1',
    '::1'
],
/* ... */

Everything! The console must be available at http://site.com/phalcon-console

As in the console are available all the services and service

Your settings

To specify your settings console, you must:

  • Create a configuration file in a convenient location, such as this content
<?php
// app/config/console-config.php
return new \Phalcon\Config([
    // If you want to specify the class test access rights to the console
    'check_access_class' => 'MyConsoleAccessCheck',

    // Check the permissions on the IP
    'check_ip' => false, // disable scanning by IP address
]);
  • Sign-up in the container service settings console to initialize the service console
$di['console.config'] = function ()
{
    // Path to correct its
    $config = require '/path/to/console-config.php';

    return $config;
};

new \Vanchelo\Console\ConsoleService($di);

For more precise information about the time of initializing the console and run the code, you must file index.php in your application to add to the rest of the code mark. line:

define('PHALCONSTART', microtime(true));

It should look something like this:

<?php
// public/index.php
define('PHALCONSTART', microtime(true));

A couple of screenshots Console Before Execute Console After Execute