Commit fb573517 authored by Patrick Barroca's avatar Patrick Barroca


parent a6a65044
......@@ -77,6 +77,43 @@ My dog has fleas.
See tests for more usage samples.
## Extending
You could need to provide your own class for a type, for example to implement
Imagine you want an Service having a ```publicKey``` property.
``` php
use \Patbator\ActivityStreams\Model\Service;
class My_ActivityPub_Service extends Service
public function __construct()
$this->_actor_attribs[] = 'publicKey';
public function type()
return 'Service';
You can declare it to type factory:
``` php
use Patbator\ActivityStreams\Model\Base;
use Patbator\ActivityStreams\Model\Factory;
Base::setFactory((new Factory)
->mapTypeToClass('Service', 'My_ActivityPub_Service'));
After that, factory will create a new ```My_ActiviyPub_Service``` for any json object with ```"type": "Service"``` instead of a ```\\Patbator\\ActivityStreams\\Model\\Service```.
## Testing
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment