aeyoll / fop_console
Add some console commands for PrestaShop 8.1.0+
Installs: 1
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 36
Type:prestashop-module
Requires
- php: ^7.2.5
- ext-json: *
- laminas/laminas-code: 3.4.1
- nette/php-generator: ^3.6
- pbergman/tree-helper: ^1.0
Requires (Dev)
- phpro/grumphp: 0.19.1
- phpstan/phpstan: 1.*
- phpunit/phpunit: ^7.0
- prestashop/php-dev-tools: 4.*
README
Friends of Presta Console
Fop console is a module which provides a set a commands to extend PrestaShop 8.1 commands.
Since version 1.7.5.0 Prestashop provides some terminal commands using the Symfony console tool.
This repository provides a base Command with better support for PrestaShop legacy classes and useful commands to easy the development on Prestashop or manage a shop. These commands are mainly for developers, just some basic knowledge of command line processing is needed.
Install from release (recommended)
Donwload a zip release and install it like any other module.
Alternatively, run this in a shell :
#!/bin/bash wget https://github.com/aeyoll/fop_console/releases/latest/download/fop_console.zip --output-document /tmp/fop_console.zip && unzip /tmp/fop_console.zip -d modules && ./bin/console pr:mo install fop_console
Install from sources
If you want use the dev branch, you can install from github. If you want to contribute, first create a fork and follow the same steps using your forked repository url instead of the original one.
cd modules
git clone https://github.com/aeyoll/fop_console.git
cd fop_console
composer install
Install the module in the backoffice or in command line like this :
cd ../../
php bin/console pr:mo install fop_console
Current commands
fop:about:version
Display the Fop Console version (on disk, on database, latest available release)fop:cache:clear
Replace the cache directory with an empty one.fop:category:clean
Manage empty categoriesfop:category:products-count
Get the number of products for category and its childrenfop:configuration:export
Export configuration values (from ps_configuration table)fop:configuration:import
Import configuration valuesfop:container:check
Health check of the Service Containerfop:customer-groups
Customer groupsfop:employee:list
List registered employeesfop:employee:change-password
Change employee passwordfop:environment:debug-mode
Enable or Disable debug mode.fop:environment:get-parameters
Display information about the installation (db name, etc)fop:environment:setup-dev
Install your project for local developementfop:export:data
Allows to export data in XMLfop:generate:htaccess
Generate the .htaccess filefop:generate:robots
Generate the robots.txt filefop:group:transfer-customers
Transfers or add customers from a group to an otherfop:hook:add
Create hook in databasefop:image:generate:categories
Regenerate categories thumbnailsfop:image:generate:manufacturers
Regenerate manufacturers thumbnailsfop:image:generate:products
Regenerate products thumbnailsfop:image:generate:stores
Regenerate stores thumbnailsfop:image:generate:suppliers
Regenerate suppliers thumbnailsfop:module:generate
Scaffold new PrestaShop modulefop:module:hook
Attach one module on specific hookfop:module:hooks
Get modules listfop:module:non-essential
Manage non essential modulesfop:module:rename
Rename a modulefop:module:unhook
Detach module from hookfop:override:make
Generate a file to make an overridefop:product:latest
Displays the latest productsfop:shop:maintenance
Configure maintenance modefop:shop:status
Display shops statusesfop:theme:reset-layout
Reset current (or selected) theme
Create your owns Commands
The official documentation from PrestaShop and Symfony Core teams are still right, but you needs to extends our class.
<?php // psr-4 autoloader namespace FOP\Console\Commands\Domain; // e.g. namespace FOP\Console\Commands\Configuration use FOP\Console\Command; use Symfony\Component\Console\Style\SymfonyStyle; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; final class DomainAction extends Command { /** * {@inheritdoc} */ protected function configure() { $this ->setName('fop:domain') // e.g 'fop:export' // or ->setName('fop:domain:action') // e.g 'fop:configuration:export' ->setDescription('Describe the command on a user perspective.'); } /** * {@inheritdoc} */ protected function execute(InputInterface $input, OutputInterface $output) { $this->io->text('Hello friends of PrestaShop!'); return 0; // return 0 on success or 1 on failure. } }
Getting started
In a shell (call it shell, console or terminal), at the root of a Prestashop installation, type this command to list all available commands. You'll see commands provided by Symfony, Prestashop and installed modules.
./bin/console list
To list only fop commands :
./bin/console list fop
To toggle the debug-mode (PS_DEV_MODE) run :
./bin/console fop:environment:debug toggle
To get help about a command :
./bin/console help fop:environment:debug
You are ready to go !
Contribute
Any contributions are very welcome :) First install from sources and see Contributing for details.
Current contributors or contributors.
Compatibility
License
This module is released under AFL license. See License for details.