Download the PHP package rubenmartindev/prestashop-module-installer without Composer

On this page you can find all versions of the php package rubenmartindev/prestashop-module-installer. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package prestashop-module-installer

PrestaShop Module Installer

rubenmartindev/prestashop-module-installer is a PHP library that provides install and uninstall helpers for PrestaShop modules.

Overview

This library simplifies common PrestaShop module installation and uninstallation tasks, including:

It is designed to be used inside PrestaShop module lifecycle methods (install and uninstall).

Installation

Install via Composer in your PrestaShop module:

Requirements

Usage

RubenMartinDev\PrestaShopModuleInstaller\Installer is designed to be used inside your module. It defines the resources that will be installed or uninstalled.

Installer uses a set of handlers (hooks, configuration, database, tabs). Each handler defines a set of items that are processed during installation and uninstallation.

Once handlers and their items are configured, you only need to call install() or uninstall().

Use the helper Installer::createFrom()

The static method Installer::createFrom() makes it easy to create handlers and items from an array.

Use as a service

If your module uses its own container, for example using prestashop/module-lib-service-container, you can create your own service to simplify Installer configuration.

The service factory receives the same arguments as Installer::createFrom().

Then retrieve the service from the container and call install() / uninstall() in the same way as in the previous example.

Installer Configuration

The Installer has a list of handlers that will be processed during installation and uninstallation.

To specify which handlers will be used, pass an array with database, or tabs, and the items each one contains.

Handlers and Items

Each handler contains a list of items executed during installation and uninstallation. Both handlers and items have the static method createFrom() to simplify configuration through an associative array.

Configuration

This handler defines the new configuration entries (ps_configuration) that will be added to PrestaShop.

Item

Represents a single configuration entry.

Argument Type Default Description
name string Required Configuration name.
value callable\|mixed Required Value to store in configuration.
prefix string\|null null Prefix to add to name.

If value is a callable, it must return a result.

value transforms its value as follows:

If prefix is null, the module name is used by default. Otherwise, it is prefixed to name.

Example

Database

This handler is used to create and remove tables in the database.

Item

Represents a single SQL statement.

Argument Type Default Description
tableName string Required Table name.
query string\|null null Raw SQL.
queryFile string\|null null Path to the SQL file.
keepData bool false Whether the table should be kept when the module is uninstalled.

Both query and queryFile support the placeholders {{DB_PREFIX}} and {{ENGINE_TYPE}}, which correspond to the PrestaShop constants _DB_PREFIX_ and _MYSQL_ENGINE_ respectively.

If both query and queryFile are set, the latter takes precedence and query will be ignored.

Example

Hooks

This handler is used to register hooks.

Item

Represents a single hook.

Argument Type Default Description
name string Required Hook name.
prestashopVersion string\|array\|null null PrestaShop version compatible with the hook.

When prestashopVersion is null, the PrestaShop version is ignored and the hook will be registered. If it is a string, the PrestaShop version is checked and the hook will only be registered if the version constraint is satisfied. If it is an array it must contain at least the min key to specify the minimum PrestaShop version from which the hook will be registered, and the optional max key to specify up to which PrestaShop version the hook should be registered.

prestashopVersion internally uses rubenmartindev/prestashop-version-checker for version validation and checking.

Example

Tabs

This handler defines and manages tabs (controllers).

Item

Represents a single tab.

Argument Type Default Description
className string Required Controller class name.
name string\|array Required Name in the menu.
parentId string\|int -1 Parent controller ID or class name.
position int 0 Position in the tabs tree.
isActive bool true Whether the tab is active.
isEnabled bool true Whether the tab is available.
routeName string\|null null Symfony route name.
icon string\|null null Icon name used in the menu.
wording string\|null null Translation.
wordingDomain string\|null null Translation domain for the tab.

When name is an array, it must be a numeric array. The array keys correspond to id_lang, and the default language ID key (PS_LANG_DEFAULT) must always be present.

When parentId is a string, the tab ID will be resolved using the class name.

When wording is null, it will be set using the value of name for the default PrestaShop language.

When wordingDomain is null, it defaults to "Admin.Navigation.Menu".

The isEnabled, routeName, icon, wording, and wordingDomain properties may be ignored depending on the PrestaShop version.

Example

Custom Handler

Although there are generic handlers for common tasks, you may need to carry out custom actions such as modifying files, creating new records or performing other tasks. To do this, you can create your own handler.

To register our custom handler, we must add it to the list of handlers in our Installer, using the FQCN of our class as the key.


All versions of prestashop-module-installer with dependencies

PHP Build Version
Package Version
Requires php Version >=5.6.0
rubenmartindev/prestashop-version-checker Version ^1.1
symfony/options-resolver Version ^3.4
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package rubenmartindev/prestashop-module-installer contains the following files

Loading the files please wait ...