Download the PHP package shopware/psh without Composer

On this page you can find all versions of the php package shopware/psh. 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 psh

Scrutinizer Code QualityBuild Statuscodecov

Latest Stable Version Total Downloads Latest Unstable Version License

PSH - PHP shell helper

Keep using your standard shell scripts

PSH is intended to be a simple and easy alternative to other build script solutions.

Table of contents

Introduction

You do not have to learn a new - and in most cases much more verbose - language, but can scale your existing skills on the command line.

Key benefits are:

Installation

Although you can use PSH as a composer dependency, we recommend to use the PHAR archive instead. PSH only communicates through the shell with your application and therefore does not need any influence on your other project dependencies.

Through composer

Locally:

Globally:

As a PHAR archive

Download psh.phar to your local environment.

As a PHAR archive via phive (preferred)

If you want to know how to install phive please click here.

Build it yourself

PSH is used to build itself. You need to clone the repository and install the composer dependencies by yourself first.

This will create a release phar in the build/psh.phar directory. The project itself requires PHP 7.2+.

Usage

Notice: The YAML configuration format is deprecated and will be removed in version 2.0. If you need the old documentation, please refer to older versions of this document

PSH is a CLI application. Before you can use it you need to create a configuration file in your project root named .psh.xml or .psh.xml.dist.

Configuration

The minimum required file looks like this:

The root element (<psh>) can contain one many or all if the following configuration options.

Paths

In order to use psh as a script executor, you need to define the locations in which to search.

PSH will then search in all these locations for *.sh files. These scripts can then be executed through PSH.

Notice: If the script name starts with a dot (.) it will be excluded from the listing, but is callable like any other script. > psh.phar .hidden-action

Placeholders

Placeholders in your scripts looks like this:

The placeholder __PATH__ now needs to be part of your configuration file as either a constant or a variable.

Notice: All placeholders must be written in uppercase in scripts. Even if defined otherwise in configuration, replacement only works uppercase. With (sic!) add the end of a placeholder it will be escaped. As an example __DIR__(sic!).

Constants

Constants are the basic solution to placeholder replacements. You define placeholders in your config like this:

This will then execute

Variables

With variables you can use the output of one line shell statements in your scripts.

The Variables get executed before the actual statement is executed, but you can imagine the outcome to be equivalent to:

Dotenv

With dotenv you have the ability to load .env-files of your project.

You can also configure multiple paths to .env files.

.env2 overrides .env in this example.

Example:

.psh.xml

.env

dev-ops/common/actions/test.sh

Require

It may be necessary to require a placeholder to be set, but can't set right away. One such example might be a system dependent path. PSH allows you to communicate this to the user by adding this:

Now unless foo is set, it is not possible to execute any psh script. The description is optional and can be omitted.

Templates

If your application depends on files that are not part of your repository because they differ for different systems (Typically *.dist files), you can use templates to achieve automatic deployment of these files.

This reads the contents of templates/consts.tpl, replaces placeholders with constants or variables from your configuration and writes the result to app/consts.php.

It is even possible to use placeholders in template destinations:

Environments

Environments are used to extend or overwrite your base configuration. You can add more scripts, redefine or add constants or variables. A environment called foo may look like this:

This environment loads all scripts from foo/sh/scripts and bar/sh/scripts, adds a constant TEST and a variable ID. If you want to call a script in this environment you have to prefix your call with foo:.

In order to exclude a whole environment from the listing add the hidden attribute to the environment tag and set it to true, like this:

These scripts can be executed like any regular script, they will just not be shown in the listing.

Headers

Optionally - and just for fun - you can output a ASCII header in front of every PSH execution.

Overriding configuration file

You can place a .psh.xml.override inside your directory where the .psh.xml is located to override the specific configurations.

Notice: You can overwrite a XML config file with a YAML file to ease the migration from one format to the other.

Importing configuration files

You can import environments, actions and placeholders by using the import statement and telling psh to look in another place.

These directories should contain a psh.xml or psh.xml.dist. If no file is found a warning is issued but no braking error, since it may very well be that psh is currently installing or downloading the files. You can also use a glob pattern like "tools/**/config"

Notice: This happens through merging the different configurations into one. Be aware that you might overwrite base configuration.

PSH-Scripts

Although most of your existing sh scripts should work just fine, you may find some of the following additions useful or necessary.

Keep in mind: Commands will be validated for successful execution -> All failures will fail the script!

Defining placeholders

In order to ensure that your scripts are reusable you can add placeholders that PSH will replace with configured values. All placeholders start and end with __, and contain only upper case letters, numbers, and single _ characters.

Including other actions

It is possible to include other scripts by it's name.

The benefit of this instead of Including other scripts is that you don't have to deal with absolute or relative paths in general.

Including other scripts

Prefixing a line with INCLUDE: will treat the remaining part of the line as the path to another script to be included and executed here.

If the path is relative, PSH will attempt to load the script relative to the location of the current script or relative to the configuration file.

On demand templates

Prefixing a line with TEMPLATE: will trigger an on demand template creation. The remaining part of the line then must look like this: SOURCE_PATH:DESTINATION_PATH

Notice that all paths here must be relative to the script location.

Defer execution to the background

Execute the script in the background, so the following command gets executed right away

Wait for all deferred commands to execute

If you then want to wait for all results, just add a WAIT in there.

Open a ssh connection to another machine

Many dev-ops script open a SSH channel to a locally running virtual machine / container or a remote staging / test system. If you do this through PSH you have to prefix the line with TTY:

Ignoring if a statement errored

Contrary to your usual shell scripts, to PSH it matters if a sh statement fails or not. If you need it to ignore errors, you have to prefix the line with I:

Breaking statements into multiple lines

If a single shell statement is to long for a single line, you can break it in PSH and intend it with three spaces in the next line. PSH will then concatenate it prior to execution and execute it all in one.

Description

You can add a description to a script which will be printed when the command list will be displayed.

Downsides

BASH-Scripts

PSH allows you to execute bash scripts directly. Most features from the above described PSH-Scripts do not work in this part of the runtime, but placeholder usage is still possible an encouraged.

So if you have Bash scripts that you want PSH to execute directly just add a second line after the shebang:

# <PSH_EXECUTE_THROUGH_CMD> will advice PSH to execute the script through your current OS.

Notice: PSH is written for security and predictability first, so it will warn you if you forget to add set -euo pipefail to the beginning of your script.

Internals

Executing it

The general format is ./psh.phar <application-options> <script-names> <script-options>. The only currently supported application option is --no-header, script names are a comma separated list of actions (or one) and script options are key value pairs to overwrite placeholders. Let's look at some examples:

Executing the phar will print a listing overview of all available commands

The first argument is always the script name. This for example will execute the unit script:

You can add more commands to be executed in a chain, by comma separating the script names:

You can add parameter for replace placeholder in your .sh files like the following examples:

in your .sh files write.

executes:

Bash Autocompletion

Bash autocompletion is only provided by PSH-Global. This will install a global script that fetches the psh.phar file in your project and that will install the autocompletion for you.


All versions of psh with dependencies

PHP Build Version
Package Version
Requires php Version ^7.2|^8.0
ext-dom Version *
symfony/finder Version ^4.4|^5.0
symfony/process Version ^4.4|^5.0
symfony/filesystem Version ^4.4|^5.0
symfony/yaml Version ^4.4|^5.0
league/climate Version ^3.6
khill/php-duration Version ^1.0
vlucas/phpdotenv Version ^5.2
symfony/config Version ^4.4|^5.0
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 shopware/psh contains the following files

Loading the files please wait ....