This guide is for Aikeedo v3.x. The plugin structure has been updated from v2.x. Plugins are now located in
/extra/extensions/
directory.What are Aikeedo Plugins?
Aikeedo plugins are Composer packages that extend the functionality of your platform. They allow you to:- Add new features and functionality
- Integrate with third-party services
- Extend existing capabilities
- Add custom currency rate providers, payment gateways, and more
Plugins give you the flexibility to tailor Aikeedo to your specific requirements without modifying the core codebase, ensuring easy updates.
Prerequisites
Before you begin, make sure you have:- Basic knowledge of PHP and Composer
- A local development environment set up for Aikeedo
- Composer installed on your system
Step-by-Step Plugin Creation
Let’s create a plugin that integrates CurrencyBeacon as an alternative currency rate provider for your Aikeedo platform.Step 1: Create the Plugin Directory
In Aikeedo v3.x, plugins are located in the/extra/extensions/
directory. Create a new directory for your plugin:
The directory structure should follow the format:
yourorganization/plugin-name
. This naming convention helps identify and organize plugins consistently.Unlike themes, plugins typically don’t need a separate
/public/e/
directory unless they provide public-facing assets like CSS or JavaScript files.Step 2: Create the composer.json File
Every Aikeedo plugin requires acomposer.json
file containing essential metadata and dependencies.
Create a composer.json
file in your plugin directory (/extra/extensions/heyaikeedo/currency-beacon/composer.json
) with the following content:
name
: Must match the path to your plugin directory (yourorganization/plugin-name
)type
: Always set toaikeedo-plugin
for Aikeedo pluginsversion
: Defines the current version of your pluginrequire
: Lists the dependencies, including the requiredheyaikeedo/composer
packageextra.entry-class
: Specifies the main class of your pluginautoload
: Sets up PSR-4 autoloading for your plugin’s classes
The
heyaikeedo/composer
package is required for all Aikeedo plugins. It provides essential functionality for plugin integration.Step 3: Create the Plugin Class
Now, let’s create the main plugin class. This class will be responsible for initializing your plugin’s functionality. Create a file namedPlugin.php
in the src
directory of your plugin:
PluginInterface
, which requires a boot
method. The boot
method is called when your plugin is loaded by Aikeedo, allowing you to set up any necessary functionality.
Step 4: Directory Structure
Your complete plugin structure should look like this:Step 5: Install the Plugin
With your plugin structure in place, you can now install it using Composer.- Via Composer (Packagist)
- Local Development
If your plugin is published on Packagist or a private repository:
Step 6: Enable the Plugin
After installation, enable your plugin through the Aikeedo admin panel:1
Navigate to Plugins
- Log in to your Aikeedo admin panel
- Go to the Plugins section
2
Activate Plugin
- Locate your new plugin (Currency Beacon) in the list
- Click the toggle or “Activate” button to enable it
Your plugin is now active and functional!
Best Practices
- Follow PSR Standards: Use PSR-4 autoloading and PSR-12 coding standards
- Version Control: Use Git to track changes and maintain version history
- Semantic Versioning: Follow semver for version numbers (e.g., 1.0.0, 1.1.0, 2.0.0)
- Documentation: Include a README.md with installation and usage instructions
- Dependencies: Only include necessary dependencies to keep the plugin lightweight
- Testing: Write tests for your plugin’s functionality
- Compatibility: Ensure your plugin works with the latest Aikeedo version
- Security: Validate and sanitize all inputs, especially from external APIs
Advanced Topics
Plugin with Public Assets
If your plugin needs CSS, JavaScript, or images, create an assets directory:/e/yourorganization/plugin-name/
in your templates.
Using Dependency Injection
Leverage Aikeedo’s dependency injection container in your plugin:Hooks and Events
Use Aikeedo’s event system to extend functionality:Troubleshooting
Plugin Not Appearing in Admin Panel
- Verify
composer.json
has"type": "aikeedo-plugin"
- Ensure the
name
field matches your directory path - Check that
heyaikeedo/composer
is in requirements - Run
composer dump-autoload
to refresh autoloader - Verify file permissions on the plugin directory
Plugin Class Not Found
- Check the
extra.entry-class
incomposer.json
matches your class namespace - Verify PSR-4 autoload configuration is correct
- Ensure the
Plugin.php
file is in the correct directory - Run
composer dump-autoload -o
Plugin Enabled But Not Working
- Check PHP error logs for exceptions
- Verify the
boot()
method is being called - Ensure all dependencies are installed
- Check that required services are available in the container
Example Implementation
For a complete, working example of an Aikeedo plugin, check out the Currency Beacon Plugin Repository on GitHub. This example demonstrates:- Proper v3.x directory structure
- Service integration
- API communication
- Error handling
- Configuration management
Related Guides
- Plugins Overview - Understanding plugins and themes
- Local Development Guide - Set up your dev environment
- API Overview - Advanced integration options
- Currency Beacon Plugin - Example implementation
Need Help?
If you need assistance with Aikeedo:Professional Support
Get expert help from our team with a paid support subscription
Troubleshooting Guide
Check common issues and solutions