2017 © Pedro Peláez
 

library ace

Ace online editor utility

image

bear/ace

Ace online editor utility

  • Sunday, April 2, 2017
  • by koriym
  • Repository
  • 1 Watchers
  • 8 Stars
  • 3,897 Installations
  • PHP
  • 2 Dependents
  • 0 Suggesters
  • 3 Forks
  • 0 Open issues
  • 9 Versions
  • 0 % Grown

The README.md

BEAR.Ace

Ace online editor utility for PHP

BEAR.Ace is an Ace utility for PHP. (Ace is a standalone code editor written in JavaScript.) It enables you to use an editor via a web service or to fix syntax errors on the fly., (*1)

BEAR.AceはオンラインエディターAceのユーティリティです。 エディターwebサービスやシンタックスエラーのオンライン修正が可能です。, (*2)

Latest Stable Version Build Status, (*3)

Getting started

Installing via Composer

The recommended way to install BEAR.Ace is through Composer., (*4)

# Install Composer
curl -sS https://getcomposer.org/installer | php

# Install as stand alone editor
php composer.phar create-project bear/ace BEAR.Ace

# Add BEAR.Ace as a dependency
php composer.phar require bear/ace:~1.0

Start the online editor web service., (*5)

$ cd BEAR.Ace/web
$ php -S localhost:8090 index.php

You can now browse file content using the 'file' and 'line' (optional) query., (*6)

Editor, (*7)

You can also save the file you are editing when you have write access to the web server. It supports save shortcut keys for Windows(Ctl+S) and OSX(Cmd+S)., (*8)

Sample Code

Getting HTML to display in the editor., (*9)

$html = (string)(new Editor)->setRootPath($rootPath)->setPath($file)->setLine($line);

You can specify a $file as an absolute path or as a relative path from $rootPath. Files higher than $rootPath are not accessible for security reasons., (*10)

Starting the online service is simple using the following code., (*11)

try {
    $editor = (new Editor)->setRootPath($rootPath)->handle($_GET, $_POST, $_SERVER);
    echo $editor;
} catch (Exception $e) {
    http_response_code($e->getCode());
    echo $e->getCode();
}

More sample code can be found in the /docs/ directory., (*12)

Syntax Error Editor

Once an error handler has been registered, when a syntax error occurs, you can not only display the error but make a fix in the browser on the fly. The browser is then automatically reloaded for you upon save. This feature can really minimize the time and frustration caused by simple careless mistakes., (*13)

(new \BEAR\Ace\ErrorEditor)->registerSyntaxErrorEdit();

Editor, (*14)

edit();

You can also view file content in the editor by using the edit function. Just specify the object or file path in the argument., (*15)

$file = __DIR__ . 'file.php';
edit($file);
$a = new A;
edit($a);

The online editor can be linked to in the stack trace file name using the following ini configuration of xdebug., (*16)

xdebug.file_link_format=localhost:8090/?file=%f&line=$l

Syntax Error Integration in Symfony2

1) Add "bear / ace" to composer.json, then install it with the composer command., (*17)

    "require": {
        ...
        "bear/ace": "*"
    },

```bash $ composer update bear/ace, (*18)


2) Register a syntax error editor in web/app_dev.php. ```php require_once __DIR__.'/../app/AppKernel.php'; // after this line (new \BEAR\Ace\ErrorEditor)->registerSyntaxErrorEdit(); // before this line $kernel = new AppKernel('dev', true);

3) That's it ! You can now fix syntax errors on the spot., (*19)

Requirements

  • PHP 5.3+

The Versions

02/04 2017

dev-develop

dev-develop http://koriym.github.io/BEAR.Ace/

Ace online editor utility

  Sources   Download

BSD-3-Clause

editor ace online editor

02/04 2017

1.0.1

1.0.1.0 http://koriym.github.io/BEAR.Ace/

Ace online editor utility

  Sources   Download

BSD-3-Clause

editor ace online editor

02/04 2017

dev-spike

dev-spike

Ace online editor utility

  Sources   Download

BSD-3-Clause

editor ace online editor

21/06 2013

dev-master

9999999-dev

Ace online editor utility

  Sources   Download

BSD-3-Clause

editor ace online editor

21/06 2013

1.0.0

1.0.0.0

Ace online editor utility

  Sources   Download

BSD-3-Clause

editor ace online editor

25/05 2013

0.2.1

0.2.1.0

Ace online editor utility

  Sources   Download

BSD-3-Clause

editor ace online editor

18/05 2013

0.2.0

0.2.0.0

Ace online editor utility

  Sources   Download

BSD-3-Clause

editor ace online editor

01/05 2013

0.1.1

0.1.1.0

Ace online editor utility

  Sources   Download

BSD-3-Clause

editor ace online editor

26/04 2013

0.1.0

0.1.0.0

Ace online editor utility

  Sources   Download

BSD-3-Clause