承接 jgswift/recompilr 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

jgswift/recompilr

Composer 安装命令:

composer require jgswift/recompilr

包简介

runtime class compiler

README 文档

README

PHP 5.5+ factory runtime class compiler

Build Status Scrutinizer Code Quality Latest Stable Version License Coverage Status

Description

recompilr uses a class definition and recompiles it at runtime using eval and a unique hash identifier. Classes may be recompiled after changes are made to the class definition without requiring the application to restart. This effectively allows an application to redeclare classes at runtime.

Installation

Install via cli using composer:

php composer.phar require jgswift/recompilr:0.1.*

Install via composer.json using composer:

{
    "require": {
        "jgswift/recompilr": "0.1.*"
    }
}

Dependency

Usage

Basic compiling and instantiation

// # path/to/FooClass.php
class FooClass {
    /* */
}

// compiles FooClass from given class definition file
recompilr\execute('FooClass','path/to/FooClass.php');

// factory creates an instance of FooClass
$foo = recompilr\make('FooClass');

var_dump($foo); // (object) FooClass_*hash

Compile from autoloaded class

// class must be available to autoloader
namespace MyNamespace;
class FooClass {
    /* */
}

// compiles FooClass without an explicit class file, relying on the autoloader to find the class definition
recompilr\execute('MyNamespace\FooClass');

// factory creates an instance of FooClass
$foo = recompilr\make('MyNamespace\FooClass');

var_dump($foo); // (object) FooClass_*hash

Recompiling everything

When class definitions are expected to have changed, all classes may be recompiled using recompilr\all.

// change path/to/FooClass.php while application is running

recompilr\all();

Note: will not compile files where bracketed namespaces are used

Note: all compiled classes are final and may not be inherited from

Binary handling

Saving to file

recompilr\execute('MyNamespace\FooClass');

recompilr\binary('path/to/binary.rcx');

Loading from file

recompilr\load('path/to/binary.rcx');

$foo = recompilr\make('MyNamespace\FooClass');

var_dump($foo); // (object) FooClass_*hash

统计信息

  • 总下载量: 6
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 2
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 2
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2014-09-28

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固