To use Magento Connect's Extension Packaging tool, open the Admin Panel where you have the extension installed that you want to package. Then, navigate to System > Magento Connect > Package Extensions. Once there, you will be greeted with a screen similar to the one below. In our example, I'll be packaging up an early version of Sitesquad InPageReviews, so that we can install it on separate development sites easily.
Page 1: Package Information
The first page is fairly straightforward. First, you have Name, which is the name of the package you're releasing. There's also Channel, which can vary, but should probably be the name of the company/team you're releasing it under.
Supported Releases is an option to signify the compatibility of your extension. With the release of Magento 1.6.0, I wouldn't be surprised to see a third option appear in that list, due to all the large changes that have taken place. Summary and Description should be filled with, respectively, short and detailed descriptions of the functions your extension offers, and who it is aimed at. License will store your license agreement version, with an option License URI to directly link to the terms
All the information on this page will be stored in a Metadata XML file that will be created along with your packaged extension.
Page 2: Release Information
Just as page 1 was about your extension as a whole, page 2 focuses on this specific release, since a growing extension can have several. Release Version should match the extension version you have defined in etc/config.xml, though that is not directly enforced by Magento. Notes allow you to add specific details about this release, which in most extensions should probably list new features, fixed errors, known bugs, or any other information that is especially important to a user who could be upgrading from a previous version.
Release Stability is an important field - it allows you to show which stage of release this version is! The options are:
- Development - Generally an internal build, being packaged for testing
- Alpha - A "first release" possibly, or more often the first development build where all the core features are complete
- Beta - The extension is nearing full release, and you may want to put out a more publicly available Beta version for experienced users to test
- Stable - Your extension is ready for the public, with minimal bugs or errors known.
Page 3: Authors
Page 3 is very simple - you just list out all the developers/authors for this extension! You can add as many authors here as you would like.
Page 4: Dependencies
Dependencies are a step that many extensions will probably need to pay very little attention to, but is also an incredibly important detail to some! If you don't properly define what your extension depends on, users without proper requirements may try and use it to no avail, resulting in bad reviews or a very bad user experience.
Minimum and Maximum PHP Versions are fairly direct. The minimum should be the earliest version that your most modern PHP language feature was introduced - in most cases, a rough milestone version like 5.1.0 or 5.2.0 is good enough if you do not know exactly when the feature was introduced, but you should try your best to find the exact release. Maximum version is usually of much less concern, as you only need to worry about it if a feature you use is marked for deprecation or has been removed. Setting this to a future release of PHP is often an acceptable option.
PackagesExtensions are where you define the names and versions of PHP extensions or add-ons that you make use of in your Magento Extension. A common example could be the GD Library, used for generating images - it is not a guaranteed on every user's PHP installation. Make sure to define any external PHP libraries you make use of here, so users know what is required by your extension to use it.
Page 5: Contents
Finally! The meat and bones of the extension packaging process - defining exactly what gets packaged! This page can be a bit confusing at first. The Target field is the section of Magento's directory structure you're pulling the files from. Here is a direct definition of what each of those options point to:
- Magento Local module file: ./app/code/local
- Magento Community module file: ./app/code/community
- Magento Core team module file: ./app/code/core
- Magento User Interface (layouts, templates): ./app/design
- Magento Global Configuration: ./app/etc
- Magento PHP Library file: ./lib
- Magento Locale language file: ./app/locale
- Magento Media library: ./media
- Magento Theme Skin (Images, CSS, JS): ./skin
- Magento Other web accessible file: .
- Magento PHPUnit test: ./tests
- Magento other: .
The Path should be relative to the Target you selected, with the Type noting whether you've pointed to a direct file or a directory. Most extensions will have at least 4 entries here - the path to the code, the path to the templates, the path to the module config file, and the path to the layout config file. Of course, some modules may have more or even less - that all depends on what you're doing!
The Include and Ignore fields allow you to limit what gets packaged into the extension from a recursive directory input. It takes wildcard inputs looking for filetypes or otherwise (for example, if you kept a log in an included file - you could add "*.log" to the Ignore section), and uses the "#" character as a delimiter. If your extension properly respects the Magento design method of separating logic and output, these will most likely be unnecessary for almost all extensions.
Saving and Accessing Your Extension
At this point, you have defined everything Magento needs to know about your extension. Clicking "Save As" will let you name your extension package within Magento (we'll return to this). Save Data and Create Package will then commit your newest version to the record, and create a packaged file for you. You can find that file in your var/connect folder, named YourExtension_Version.tgz. You will also find the file YourExtension.xml, which has all the metadata you inserted in step 1. From here, you can use these files to import your extension easily through Magento Connect to any installation of Magento!
Making Changes or a New Version (Page 6)
So, you've packaged and released your extension. But like any piece of software, it will need changes! Fixes and new features are commonplace. Luckily, once you've created your extension, you don't have to go through the hassle of inserting all the same information over and over again. Once you save it, you can easily load it from Page 6: Load Local Package any time you want. Clicking one of your packages on this screen will populate the other pages with all the information you previously saved, meaning you only have to make minor changes - version, notes, and maybe a folder change or two. It makes rolling out new releases quick and simple.
Hopefully this guide helps you get your site's extensions ready to roll out. If you have any questions I didn't address here, post them in the comments and we can try and help you out!