PHPackages                             solidworx/aspect - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. solidworx/aspect

ActivePhp-ext[Utility &amp; Helpers](/categories/utility)

solidworx/aspect
================

PHP Aspect Extension

0.1.1(1y ago)23103[1 issues](https://github.com/SolidWorx/aspect/issues)MITCPHP ^8.0CI failing

Since Nov 28Pushed 1y ago2 watchersCompare

[ Source](https://github.com/SolidWorx/aspect)[ Packagist](https://packagist.org/packages/solidworx/aspect)[ RSS](/packages/solidworx-aspect/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (2)DependenciesVersions (3)Used By (0)

Aspect PHP Extension
====================

[](#aspect-php-extension)

Aspect is a PHP extension that provides a collection of utilities designed to enhance your development workflow. By introducing advanced features like attribute-based memoization, Aspect allows developers to write more efficient, clean, and maintainable code without the overhead of implementing complex patterns manually.

Table of Contents
-----------------

[](#table-of-contents)

- [Installation](#installation)
- [Features](#features)
    - [Memoization with Attributes](#memoization-with-attributes)
        - [Usage](#usage)
        - [Examples](#examples)
        - [Benefits](#benefits)
- [License](#license)

Installation
------------

[](#installation)

To install the Aspect extension, you can use [Pie](https://github.com/php/pie):

```
pie install solidworx/aspect
```

Features
--------

[](#features)

### Memoization with Attributes

[](#memoization-with-attributes)

The `#[Memoize]` attribute enables you to effortlessly cache the results of function or method calls based on their input arguments. This means that repeated calls with the same parameters will return the cached result instantly, without re-executing the underlying code.

#### Usage

[](#usage)

To use the memoization feature, simply add the `#[Memoize]` attribute above the function or method you wish to cache.

```
