Packaging a Magento Extension
Packaging a Magento extension in CE 1.5+ has changed due to the creation of Magento Connect 2.0 – If you are packaging in CE 1.5+, please refer to this new wiki page. If you have questions, please refer to the Magento Connect forum for further guidance.
This admin page will help to package your extensions, such as modules, add-ons, language packs, interfaces and themes, into PEAR packages which you could upload to MagentoConnect and share with other community members.
For starting on extension packaging process, log in to Magento Admin panel and go to :
Admin Panel: » System » Magento Connect » Package Extensions
You can easily follow the 5 step process there to generate the extension that are described in the remaining article.
The extension packaging process includes generation of package.xml file with information about the package collected by the 5 steps below, and archiving content files and folders specified by the Contents step.
After package release is uploaded to MagentoConnect, it will be available for download and installation for other members, by pasting extension key into MagentoConnect downloader.
Is constructed from
- PEAR channel nickname (
- Short package name (
- Numeric release version (
1.2.3) or release stability (
beta) - optional
So the extension key could look like this:
magento-core/Mage_Core_Modules-1.2.3- specific release version will be installed
magento-core/Mage_Core_Modules-beta- latest beta release will be installed
magento-core/Mage_Core_Modules- latest release for local stability settings will be installed
Make sure that downloader/pearlib/php and var/pear folders exist and have writable permissions for the web service.
- In version 1.0 you should run these commands before packaging extensions, to initialize PEAR packager:
cd downloader ./pear mage-setup
- In all Channel fields use:
- CORE packages:
- COMMUNITY packages:
Any Suggestions on what to do in version 1.2?
Any Suggestion for local(not member of community and core)
Is divided into 5 steps, detailed below.
After all steps have been completed, you can click “Save” button to save package information info into var/pear/<package_name>.ser file for future retrieval by clicking “Load” button.
Also you can generate the release package by clicking on “Save data and Create Package” button, which will validate information and create .tar.gz file in var/pear that you can upload to MagentoConnect.
NOTE: Extensions are case sensitive. Make sure the package name reflects accordingly in all folders and xml files. e.g. MyExtension is not same as Myextension.
NOTE: The package name must NOT have space inside. For example, use Foo_Bar, don’t use “Foo Bar”. You will have ”There was a problem saving package data” when you save the extension if there is space inside the module name.
NOTE: Make sure you have zlib enabled in your php cli. Typically it is under “/usr/local/bin/php”. Otherwise you won’t be able to generate the package.
NOTE: You can manually build the pear package from cli once the package.xml is generated using “pear mp package.xml”. Follow This Blog
Here is general information about package without regards to releases or versions
- Name: PEAR short package name, ( Mage_Oscommerce )
- Channel: For community packages use (connect.magentocommerce.com/community)
- Summary: Short package definition
- Description: Extended package definition
- License: Extension license name (OSL v3.0)
- License URI: Web URL for license text (http://www.opensource.org/licenses/osl-3.0.php)
In this tab provide release/version specific information
- Release Version: Major, minor, revision and stability for the release (1.1.20123)
- API Version: Major and minor version for API used in this release (1.0)
- Release Stability: Stability of this release (alpha)
- API Stability: Stability of the API used in this release (stable)
- Notes: Release notes for users and developers
Maintainers of the package, user names the same as in MagentoConnect Only LEAD maintainers can upload releases The User field is your magentocommerce.com user name (found under My Account, User Name and Password). Don’t use your screen name here.
- PHP Version: this setup will work only with PHP5 >= 5.2.0
- Minimum: 5.2.0
- Maximum: 6.0.0
- Exclude: 6.0.0
Dependencies for current package
- Package: short package name (Mage_Core_Modules)
- Min: minimum supported version of dependent package
- Max: maximum supported version of dependent package
- Recommended: downloader will try to use this version even if newer available
- Exclude: comma separated list of versions that are not supported
- Required: this dependency required for successful installation
- Optional: this package will be shown during installation as available option
- Conflicts: this package versions conflict with current package
Used when new release of current package was splitted into 2 or more packages.
In general no packages can share same files, but subpackages can contain files that were used in previous version of current package.
Fields: same as in packages
PHP/PECL extensions dependencies
- Extension: dropdown with currently installed PHP extensions
- Min, Max, Recommended, Exclude, Type: same as in packages
- Target: Location of the files to include
- Path: Path within the target (location). The path is relative to role directory. ex: Magento Community Module file is relative to app/code/community/ ; Magento Global Configuration is relative to app/etc/ ...
- Type: File or Recursive Directory
- Include: Regular expression for file pattern to include (requires pattern delimiter, like ‘#’) - ex. #^Mage#
- Ignore: Regular expression for file pattern to ignore (requires pattern delimiter, like ‘#’)