SkillAgentSearch skills...

Framework

:gem: Go! AOP PHP - modern aspect-oriented framework for the new level of software development

Install / Use

/learn @goaop/Framework
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

Go! Aspect-Oriented Framework for PHP

This framework brings Aspect-Oriented Programming to PHP — a powerful paradigm for handling cross-cutting concerns that don't fit neatly into traditional OOP like logging, caching, and security checks across hundreds of methods. Go! AOP solves this problem elegantly—define such behaviors as aspect classes once, and apply them automatically everywhere when needed. Your business logic stays clean, your infrastructure code stays organized.

GitHub Workflow Status PHPStan Badge GitHub release Total Downloads Daily Downloads Minimum PHP Version License Sponsor

✨ Features

🔌 Zero Dependencies, Pure PHP

  • No PECL/PIE extensions required — Forget about php-aop, runkit, uopz, or any other low-level extensions. Go! AOP is written in 100% pure PHP — just composer require and you're ready. No compilation, no system dependencies, no deployment headaches.

  • Zero eval() calls — Your architecture team will love this. Framework never uses eval(), create_function() constructions for dynamic code execution. All transformations produce static PHP files that can be reviewed, scanned by security tools, and audited. No hidden code generation at runtime.

  • PHPStan Level 10 — The entire codebase passes PHPStan's strictest analysis level — maximum type safety, no mixed types escaping, full type-aware support. This means fewer bugs, better IDE autocompletion, and confidence that the framework won't introduce type errors into your application.

🎯 Powerful Core Interception Capabilities

The framework provides powerful core interception capabilities that can be used to hook into any method in your application:

| Feature | Support | |--------------------------------------------|:-------:| | Interception of public & protected methods | ✅ | | Interception of static and final methods | ✅ | | Interception of private methods | ✅ | | Interception of methods in final classes | ✅ | | Interception of trait methods | ✅ | | Interception of enum methods (PHP 8.1+) | ✅ | | Before, After and Around type of hooks | ✅ |

🛠️ Developer Experience

  • Rich pointcut syntax — Express complex matching rules with an intuitive, readable grammar. Target methods by visibility, name patterns, annotations, class hierarchy, and more — all in a single expression like execution(public **->save*(*)).

  • Full XDebug support — Unlike other AOP solutions that generate unreadable proxy code, the framework produces clean, debuggable PHP. Set breakpoints directly in your aspects or original classes — step through code naturally, inspect variables, and debug as if AOP wasn't there.

  • Readable weaved code — No magic methods, no __call() indirection or runtime proxies. The transformed source is plain PHP that you can read, understand, and audit. What you see in the cache is what gets executed.

  • Framework-agnostic — integrates with popular frameworks and vanilla PHP. Works equally well in legacy applications or greenfield projects — no architectural changes required.

⚡ Production Ready

  • Lightning fast — Quick start in just few ms. Aspects are initialized once and cached, so subsequent requests have virtually zero initialization overhead.

  • Opcode cache friendly — First-class support for OPcache. Transformed files and classes are stored as plain PHP files, fully optimized by your opcode cache just like regular code.

  • Smart caching — Lazy loading of advice and aspects — only what's needed gets loaded. Joinpoints are resolved at compile-time and cached, eliminating runtime reflection costs.

  • No runtime overhead — Zero runtime annotation parsing, no slow __call methods, no proxy objects wrapping your instances. Method interception happens through direct, inlined PHP code — as fast as handwritten cross-cutting code. Zero overhead for non-intercepted methods.

What is AOP?

Aspect-Oriented Programming (AOP) is a programming paradigm that complements Object-Oriented Programming by solving a fundamental problem: cross-cutting concerns.

The Problem with Traditional OOP

In OOP, we organize code into classes with clear responsibilities. But some behaviors refuse to fit neatly into this model — they cut across many classes:

  • Logging — you need it in dozens of methods across your application
  • Caching — scattered throughout services and repositories
  • Security checks — repeated before every sensitive operation
  • Transaction management — wrapping multiple database operations
  • Performance monitoring — measuring execution time everywhere

With pure OOP, you end up copying the same code into hundreds of places. When requirements change, you hunt through the entire codebase. This is called code scattering and code tangling — and it violates the DRY and DDD principle at scale.

The AOP Solution

AOP introduces a simple but powerful idea: define cross-cutting behavior once, apply it automatically wherever needed.

Think of it like life advice. Your mentor doesn't follow you around repeating "check your inputs before every decision." Instead, they give you one piece of advice that you apply in many situations. AOP works the same way — you write the advice once, and the framework applies it at the right moments.

Core Concepts

| Concept | What It Means | Real-World Analogy | |----------------|-------------------------------------------------------------------------------------|-----------------------------------------------------------------------| | Aspect | A module containing cross-cutting logic (logging, caching, etc.) | A chapter in a guidebook covering the document signing process | | Join Point | A specific moment in code execution — method call, property access, object creation | A decision point in your day where advice could apply | | Advice | The actual code that runs at a join point | The specific guidance: "Before signing the document, read everything" | | Pointcut | A pattern that selects which join points to target | The rule for when advice applies: "Before signing any contract" | | Weaving | The process of applying aspects to your code | The mentor's words becoming part of your thinking |

Types of Advice

Just like life advice can be applied at different moments, AOP advice has different timing:

| Advice Type | When It Runs | Example Use Case | |---------------------|----------------------------------|------------------------------------| | Before | Right before the method executes | Validate input, check permissions | | After (Finally) | Always, regardless of outcome | Release resources, stop timers | | Around | Wraps the entire execution | Caching, transactions, retry logic | | After Throwing | When an exception is thrown | Log errors, send alerts |

Around advice is the most powerful — it controls whether the original method runs at all, can modify arguments, change return values, or handle exceptions.

Advanced: Introductions

Go! AOP can do more than intercept behavior — it can add entirely new capabilities to existing classes. This is called an Introduction (or inter-type declaration).

Want all your DTOs to implement Serializable? Instead of modifying every class, declare it once in an aspect — Go! AOP adds the interface and implementation automatically. No inheritance hierarchies, no code duplication.

How Go! AOP Works

Unlike frameworks requiring special compilation steps, Go! AOP performs runtime weaving — it transforms your classes when they're loaded into PHP. No build process, no generated files to commit. Your original source code stays untouched, and the framework handles everything transparently.

Installation

Go! AOP framework can be installed with composer. Installation is quite easy:

  1. Download the framework using composer
  2. Create an application aspect kernel
  3. Configure the aspect kernel in the front controller
  4. Create an aspect
  5. Register the aspect in the aspect kernel

Step 0 (optional): Try demo examples in the framework

Ask composer to create a new project in empty directory:

composer create-project goaop/framework

After that configure your web server to demos/ folder and open it in your browser. Then you can look at some demo examples before going deeper into installing it in your project.

Step 1: D

Related Skills

View on GitHub
GitHub Stars1.7k
CategoryDevelopment
Updated1d ago
Forks165

Languages

PHP

Security Score

100/100

Audited on Mar 30, 2026

No findings