We are moving our forum in GitHub Discussions. For questions about Phalcon v3/v4 you can visit here and for Phalcon v5 here.

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


You may consider using strategy design pattern : http://sourcemaking.com/design_patterns/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

edited Feb '15
        "Facebook" => APPLICATION_PATH."/../library/Facebook",




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.