Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

How can I create a plugin and how can I call it

I need to create a facebook login plugin. I have alredy downloaded the SDK which I extracted and stored in a folder called facebook. Inside a plugin folder I created placed inside app folder. -App --Plugins ---facebook ----src files
Please advice. Thanks



5.8k

You may consider using strategy design pattern : http://sourcemaking.com/design%5patterns/strategy

I have managed by creating a directory plugins and registering it with autoloader in order for my app to easily access its classes. After that I set its classes in the DI component through service.php



1.4k
edited Feb '15
$loader->registerNamespaces(
        array(
        "Facebook" => APPLICATION_PATH."/../library/Facebook",
                )
);

and..

https://gist.github.com/JREAM/8554151



13.9k
Accepted
answer

I Added the plugins directory holding the classes in the config file and then registered my plugin in the service file through the di component.

After that I am able to execute it as I need in the application controllers.