Make Your Own Plugin, Part 2: Packaging and Distributing
Now that you know how to create a plugin control, all that's left before you can share your plugin is to package it nicely, test it, and you're good to go!
See other plugins for examples of the directory structure required.
You may see some or all of the following directories in a QCubed library:
- src - PHP source code. This will be pointed to by the composer.json file inclued with the library. You may see the following
- A "Gen" file, which often is actually generated by creating a php program that will scrape a website and build the user interface directly from the documentation. That is how the JQueryUI files are created. This file essentially represents the exposing of the raw functionality of the widget to QCubed.
- A "Base" file, which overrides the Gen file and contains code to more elegantly interface the raw widget interface with the the way QCubed handles controls.
- examples - Example code for new users demonstrating use of the library. These should be pointed to by the composer.json file so that the Library manager can make the examples easily accessible to users of the library.
- install - These are files that get moved out of the vendor directory after installation, IF they do not already exist. The directory structure here should mirror the root directory, and will indicate where files should be placed. The files here might include configuration settings, code generation templates, control registry settings, and more. If the file already exists in the location indicated, it will not be over-written.
- tools - Command line tools and other support files. For example, if some of your control is automatically generated from scraped web pages, like our implementation of the JQuery UI library is, place the scraper source code here so others can run it too.
- i18n - Translation files to translate the text strings in your library to various languages.
Include a composer.json file in the root directory of your control. Its probably easiest to copy one from a current plugin and edit it. In that file, give your library a type of "qcubed-library"
Create a new repository in your own GitHub account, and upload your directory to the repository. Point to your repository from your main qcubed composer.json file, and try a Composer Install command to see if your control will install. Try it out in your project and see if you can use it.
Once you are ready to give it to the community, post an issue in the QCubed Github website. One of the core developers will take a look, and add it to our list of known libraries to install. Generally, we will not move these controls to the QCubed repository, but we will point people to your repo so that you can continue to maintain your QCubed library.