wheakerd/php-mimic 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

wheakerd/php-mimic

Composer 安装命令:

composer require wheakerd/php-mimic

包简介

A transparent AOP library for PHP.

关键字:

README 文档

README

A transparent AOP library for PHP.

What is Mimic?

PHP-Mimic is a transparent AOP (Aspect-Oriented Programming) framework that intercepts class loading at the stream level. It reshapes code on-the-fly via AST (Abstract Syntax Tree) manipulation, enabling non-intrusive logic injection into any class—including final classes and methods—without modifying original source files or requiring manual proxies.

Core Philosophy

  • Transparent: Works with native new, static, and instanceof calls.
  • Intrusive but Safe: Capability to intercept final members and private scopes.
  • Debug-First: Integrated source-mapping ensures stack traces and error reports point back to original file paths and line numbers.
  • Zero Eval: No eval() is used. All code is processed via custom stream wrappers and the Zend OPcache.

Installation

composer require wheakerd/php-mimic

Quick Start

1. Initialize the Kernel

Register the aop:// protocol and hijack the autoloader.

$mimic = new MimicFactory();

$mimic->register(
    [
        TestCaseService::class => $composerLoader->findFile(TestCaseService::class),
    ],
)->intercept([TestCaseService::class, 'handle'], function (ProceedingJoinPoint $point) {
    var_dump('Print return value:' . $point->proceed());

    return 999;
});

// Direct your autoloader to use the aop:// prefix

License

BSD 3-Clause License (New or Revised)

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: BSD-3-Clause
  • 更新时间: 2026-04-11

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固