Download the PHP package rcrdortiz/axpecto without Composer
On this page you can find all versions of the php package rcrdortiz/axpecto. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download rcrdortiz/axpecto
More information about rcrdortiz/axpecto
Files in rcrdortiz/axpecto
Package axpecto
Short Description PHP meta‑framework for modern, AI‑augmented, aspect‑oriented development.
License MIT
Informations about the package axpecto
✨ Axpecto — A Modern PHP Meta-Framework
Axpecto is a powerful meta-framework for modern PHP development. It blends Aspect-Oriented Programming (AOP), dependency injection (DI), and enhanced collections, into a highly composable and extensible architecture designed for AI-augmented development.
With Axpecto, you can:
- Build flexible, modular frameworks (e.g., WordPress dev kits, internal platforms).
- Inject behavior into code using clean, declarative annotations.
- Autowire dependencies, inject properties, and intercept method calls without boilerplate.
- Work with expressive Kotlin-style collections in a PHP-native way.
⚙️ Axpecto is designed not just for developers, but for AI agents to extend, understand, and modify code easily, safely and cost efficiently.
✨ Features at a Glance
- ✅ Aspect-Oriented Programming (AOP) via annotations and proxies.
- ✅ Powerful DI container with autowiring, circular reference detection, and injection via attributes.
- ✅ Build-time annotations that transform abstract classes and interfaces into runtime-ready implementations.
- ✅ Method execution interception for logging, caching, validation, etc.
- ✅ Kotlin-inspired immutable/mutable collections (
Klist,Kmap) for functional-style workflows. - ✅ AI-friendly architecture: easy to analyze, extend, and generate.
📦 Installation
Install via Composer:
🚀 Quickstart
🔁 Functional Collections
Use Axpecto's Klist and Kmap for expressive list handling:
Collections are immutable by default, but can be made mutable with $list->toMutable().
Real-World Example: Extract and format user names
Real-World Example: Group and filter by condition
Real-World Example: Using maybe to conditionally perform a context aware action
Real-World Example: Checking conditions with all and any
Comparison to native PHP:
🧠 Dependency Injection
Axpecto's DI container autowires your services, resolves dependencies via type hints, and supports injection via #[Inject].
You can also register services manually:
Constructor-Based Injection (Preferred)
The most common way to inject dependencies in Axpecto is through the constructor. The container resolves all parameters by type and automatically wires them:
Property Injection (when constructor-based injection is not ideal)
Example: Reusing and re-binding implementations
📍 Aspect-Oriented Programming
You can define annotations that intercept method calls, allowing you to:
- Apply caching, logging, or validation logic.
- Modify arguments or results.
- Inject cross-cutting behavior without polluting your core logic.
The method execution is intercepted by HtmlOutputHandler, which transforms the output into a templated HTML page.
🏗️ Build-Time Annotations (Dynamic Class Generation)
Declare abstract classes with metadata that Axpecto will build into concrete implementations:
Axpecto parses this and auto-generates logic to resolve database access without manual boilerplate.
🧪 Example Build Annotation: #[Service]
⚡ Method Execution Interception
Intercept method calls to apply logic dynamically.
Example: #[Cacheable]
Example: #[Logged]
🗃️ Using #[Repository] in Axpecto
⚠️ The repository feature is under construction and could change.
The #[Repository] annotation in Axpecto allows you to define data access logic declaratively by marking an interface or abstract class as a repository. When the container encounters this class, Axpecto will build the implementation automatically, parsing method names and generating queries based on conventions and entity metadata.
🔍 What #[Repository] Does
When you annotate a class with #[Repository], Axpecto:
- Reads the
entityClassthat this repository manages. - Parses abstract method names to extract conditions (e.g.,
findByIdAndEmailIsNotNull). - Generates runtime code that:
- Builds a
Criteriaobject. - Maps entity properties to database fields.
- Calls the appropriate persistence logic.
- Builds a
- Injects dependencies like the entity mapper and persistence strategy.
This behavior is defined by the RepositoryBuildHandler, which is automatically injected and associated with the annotation.
This defines a CustomerRepository where the methods will be built automatically. When you call:
✅ Basic Example
Axpecto builds the logic to create a Criteria, apply the field conditions, and use the underlying storage to fetch and map the entity.
🧠 Behind the Scenes
The handler responsible is RepositoryBuildHandler, which:
- Uses ReflectionUtils to inspect the entity and repository class.
- Parses method names using RepositoryMethodNameParser.
- Resolves annotations like #[Entity], #[Mapping], #[Id], etc.
- Maps method parameters to conditions.
- Outputs real executable code injected at runtime via the BuildContext.
💡 Entity Example
🧪 Tips and Best Practices
- ✅ Use clear, expressive method names — they’re parsed to build conditions.
- ✅ Combine with
#[Column]annotations on entities to customize DB fields. - ⚠️ Avoid overly complex method names with too many logical branches.
- ✅ Great for CRUD interfaces, admin panels, or quick scaffolding.
🛠 Advanced Ideas
You can extend this concept with:
#[Entity(storage: MyCustomStrategy::class)]for custom persistence backends.- Auto-generated GraphQL endpoints based on repository methods.
- Caching, logging, or access control annotations layered on top of repositories.
📊 Use Cases
Here are just a few ways you can use Axpecto:
🖥️ Build a WordPress Plugin Framework
- Use Axpecto to structure plugin architecture.
- Inject services like settings managers, loggers, or HTTP clients.
- Wrap admin views with custom output annotations like
#[HtmlOutput].
⚙️ Declarative Validation & Security
🚀 AI-Generated Plugins
- Define plugin behavior with attributes.
- Let an AI generate or extend logic without modifying core classes.
💡 Scalable Domain Framework
- Define domain repositories via interfaces and
#[Repository]annotations. - Use
#[Entity]and#[Mapping]to drive your ORM logic.
🌟 Developer Experience Enhancements
- Annotate logging, caching, rate-limiting.
- Inject metadata to methods without touching implementation.
🔗 Architecture & Philosophy
Axpecto is a meta-framework. It's:
- Annotation-first: Behavior is declarative, composable, and introspectable.
- AI-extendable: Built to be easily parsed, modified, and extended by AI.
- Framework-agnostic: Use in Laravel, Symfony, WordPress, or your own stack.
- Composable: Swap DI, AOP, or collections independently.
💪 Contributing
Contributions are welcome! Check out the CONTRIBUTING.md and explore /examples for demos.
📄 License
MIT License. See LICENSE for full terms.
All versions of axpecto with dependencies
ext-mysqli Version *
ext-pdo Version *