Skip to content

About

No description, website, or topics provided.

Resources

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

M4P Module Starter

An open-source starting point for PrestaShop modules, released under the MIT license by Nice Code (Modules4Presta). It gives you the module skeleton, a rename script, coding-standard configs and a CI/release pipeline, so a new module starts with the boring parts already done.

Works with PrestaShop 1.7.6+, 8.x and 9.x. Requires PHP 7.2.5+.

Getting started

  1. Click Use this template on GitHub and create your repository.

  2. Clone it and rename the module:

    ./scripts/rename-module.sh m4p_yourmodule

    The script renames files, the main class, config.xml, config_pl.xml and every reference in the code. Module names must be lowercase and may contain a-z, 0-9 and _.

  3. Set your own name in composer.json, in the module header and in $this->author, then replace this README.

  4. Copy the folder to <prestashop>/modules/ and install the module from the back office.

What is inside

.
├── .github/
│   ├── ISSUE_TEMPLATE/     # bug report, feature request
│   └── workflows/          # CI + gated auto-release
├── classes/                # ObjectModel and helper classes
├── controllers/
│   ├── admin/              # back-office controllers
│   └── front/              # front-office controllers
├── mails/                  # mail templates (en, pl)
├── override/               # core overrides
├── sql/                    # install.php, uninstall.php
├── translations/
├── upgrade/                # upgrade-X.Y.Z.php scripts
├── views/{css,js,img,templates}
├── config.xml              # module manifest (EN)
├── config_pl.xml           # module manifest (PL)
└── m4pmodulestarter.php    # main module file

Every directory has an index.php guard, the way PrestaShop expects.

Coding standards

composer install
composer phpcs       # PrestaShop ruleset report
composer phpcbf      # auto-fix what PHPCS can fix
composer cs-check    # PHP-CS-Fixer dry run
composer cs-fix      # apply PHP-CS-Fixer

CI and releases

ci.yml runs on every push and pull request: php -l on PHP 7.4 / 8.1 / 8.2, PHPCS with the PrestaShop ruleset, PHP-CS-Fixer in dry-run mode, and a check that $this->version matches config.xml.

release.yml starts only after CI succeeds on main. It reads $this->version, and if the tag does not exist yet it creates vX.Y.Z, builds an installable ZIP and publishes a GitHub release. So releasing a version means: bump $this->version and both config*.xml, merge to main.

License

MIT — see LICENSE. Use it commercially, fork it, rename it; just keep the copyright notice. Modules built from this starter can carry any license you choose.

Contributing

Bug reports and pull requests are welcome — see CONTRIBUTING.md. For security issues, please follow SECURITY.md instead of opening a public issue.

About

No description, website, or topics provided.

Resources

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages