Download the PHP package jbdevlabs/sylius-cli-context-plugin without Composer

On this page you can find all versions of the php package jbdevlabs/sylius-cli-context-plugin. 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 sylius-cli-context-plugin

Cli Context Plugin

This plugin provide a default channel context for your Symfony Command.

When Sylius load a resource implements Sylius\Component\Resource\Model\TranslatableInterface, a DoctrinepostLoad event listener defines the default local and the current locale into the loaded object. The current local is determined from the current HTTP request and the ChannelContext.

In HTTP context, the current channel into ChannelContext is defined from hostname.

In Console context (cli), we have no HTTP request and the ChannelContext is empty. When you load a translatable resource, the channel context will load the first channel after running the findAll function on ChannelRepository.

But the ChannelContext will execute the findAll function for each resource loaded. The more you load resource more your command consume more memory and use more CPU resources.

Know issues: Performance issue in cli commands: channel db request after each translatable entity postLoad event and Multiple channels with php-cli is not possible

This Sylius plugin allows you to load the channel into the ChannelContext on ConsoleCommandEvent event. The findAll function on ChannelRepository will never be executed by ChannelContext and you preserve your performances.

Installation

Run the command composer require jbdevlabs/sylius-cli-context-plugin dev-main

Extends the Sylius Channel Repository

Note: If you have already extended the ChannelRepository, implement the interface JbDevLabs\SyliusCliContextPlugin\Repository\CliChannelProviderInterface and use the trait JbDevLabs\SyliusCliContextPlugin\Repository\CliChannelProviderTrait for interface implementation. Goto the alias configuration step.

Implement and use trait

Make a new PHP class ChannelRepository in src/Repository like this:

Configure the new repository

Declare this repository on config/packages/_sylius.yaml file like this:

Fix the interface alias

Declare the alias for JbDevLabs\SyliusCliContextPlugin\Repository\CliChannelProviderInterface to the channel repository.

Configuration

Add a file jb_dev_labs_sylius_cli_context.yaml into config/packages and set your configuration.

Usage on your command

By default, no Channel context is loaded.

To automaticaly load channel context for your command, implement the interface JbDevLabs\SyliusCliContextPlugin\Command\CliContextAwareInterface on your command.

Example:

Usage on bundle command

You want load the Sylius Channel context when command provided by another plugin is executed ?

Add the command class namespace on your configuration to enable the Context initialisation.

Usage programatically

See the documentation

Contributor Installation (docker)

  1. Clone this project

  2. From the plugin skeleton root directory, run the following commands:

Quality tools

ProTip use Makefile ;)

Contributor quickstart Installation (legacy)

  1. Clone this project

  2. From the plugin skeleton root directory, run the following commands:

To be able to setup a plugin's database, remember to configure you database credentials in tests/Application/.env and tests/Application/.env.test.

Usage

Running plugin tests

Opening Sylius with your plugin


All versions of sylius-cli-context-plugin with dependencies

PHP Build Version
Package Version
Requires php Version >=8.1
sylius/sylius Version ^1.11
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 jbdevlabs/sylius-cli-context-plugin contains the following files

Loading the files please wait ....