Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

added aspect registration example

  • Loading branch information...
commit 494a1bca694280de50ee975ab2ff6e1194904546 1 parent 33fbbcb
@Matthimatiker authored
Showing with 18 additions and 2 deletions.
  1. +18 −2 README.md
View
20 README.md
@@ -10,8 +10,6 @@ provided by the PHP Core.
AspectPHP requires at least *PHP 5.3*. No additional packages or
extensions are required.
-## Concept ##
-
## Installation ##
### Composer ###
@@ -104,3 +102,21 @@ to the method that triggered it:
or an exception.
### Register Aspect ###
+
+To activate an aspect an instance of the class must be registered at the
+aspect manager.
+
+The manager can be retrieved from the environment:
+
+ $manager = $environment->getManager();
+
+The *register()* method is used to add the aspect:
+
+ $manager->register(new DemoAspect());
+
+Afterwards each call to a *Demo* method triggers the *beforeExecution()*
+advice:
+
+ $demo = new Demo();
+ // Displays "before sayHello" and executes sayHello() afterwards.
+ $demo->sayHello();
Please sign in to comment.
Something went wrong with that request. Please try again.