/kjmodulebedrock

Module bedrock for PrestaShop

Primary LanguagePHPAcademic Free License v3.0AFL-3.0

Module bedrock for PrestaShop

PHP tests GitHub release GitHub license

About

Tired of building module from scratch every time?
Not satisfied with the PrestaShop generator?
Want an up-to-date bedrock to start with?

Consider cloning this repository and start from kjmodulebedrock!

You can use it freely to develop and sell your own modules.

Essential features

Usage

Installation

Get started

git clone https://github.com/Kaudaj/kjmodulebedrock.git

# Then create your own module from it
cp -R kjmodulebedrock yourmodule
cd yourmodule
rm -rf .git
git init
composer install
cd _dev
npm install

Recommended: Automate the process

Here is a bash script to create a new module from kjmodulebedrock.
It uses fop:module:rename command from fop_console project to automate the "search/replace occurences" process. It will also link the local repository to your GitHub remote one if it exists.

It's highly recommended to create an alias for the create-new-module script in order to use it in all your PrestaShop projects. The instructions are available in this gist. Replace <your-command> by /path/to/create-new-module.sh and your-alias with whatever you want.
Make sure you are at the root of your PrestaShop environment and run the script like this:

your-alias PREFIX,ModuleClassName

# Example
ps-new-module KJ,MyModule

Configuration

  • tests/php/.phpstan_bootstrap_config.php
    For GrumPHP: Set PrestaShop installation path for PHPStan task.
    Replace default path with the root path of a stable PrestaShop environment.
  • tests/php/.env
    For GrumPHP: Set PHP executables path for syntax checking tasks.
    tests/php/.env.dist is used as a fallback, filled with Ubuntu default locations.

Development

Here are some useful commands you could need during your development workflow:

  • composer grum
    Run GrumPHP tasks suite.
  • composer header-stamp
    Add license headers to files.
  • composer autoindex
    Add index files in directories.
  • composer dumpautoload -a
    Update the autoloader when you add new classes in a classmap package (src and tests folder here).
  • npm run watch
    (in _dev folder) Watch for changes in _dev folder and build automatically the assets in views/dist folder. It's recommended to run it in background, in a dedicated terminal.

Compatibility

PrestaShop >=1.7.8.0
PHP >=7.1 for production and >=7.3 for development
Multishop ✔️

License

Academic Free License 3.0.

Reporting issues

You can report issues in this very repository.

Contributing

As it is an open source project, everyone is welcome and even encouraged to contribute with their own improvements!

To contribute in the best way possible, you want to follow the PrestaShop contribution guidelines.

Contact

Feel free to contact us by email at info@kaudaj.com.