Download the PHP package kuria/composer-pkg-scripts without Composer

On this page you can find all versions of the php package kuria/composer-pkg-scripts. 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 composer-pkg-scripts

Composer package scripts ########################

Composer plugin that provides a way for packages to expose custom scripts to the root project. These scripts work similarly to the root-only scripts option.

:depth: 2

Requirements

Terminology

root package the main package (project)

root script a script defined in the root package's scripts option

package script a script defined in a package's extra.package-scripts option

Installation

Specify kuria/composer-pkg-scripts as a dependency in your composer.json.

This can be done either in the root package or in one of the required packages (perhaps a metapackage?). That depends entirely on your use case.

javascript

{ // ... "require": { "kuria/composer-pkg-scripts": "^1.0" } }

Defining package scripts

Package scripts can be defined in the composer.json's extra option.

The syntax is identical to the root-only scripts option. See Composer docs - defining scripts.

javascript

{ "name": "acme/example", // ... "extra": { "package-scripts": { "hello-world": "echo Hello world!", "php-version": "php -v" } } }

The final script names are automatically prefixed by the package name.

The example above will define the following scripts:

To define shorter aliases, see Specifying aliases and help.

Referencing other scripts

In addition to the root scripts, package scripts may reference other package scripts defined in the same file.

See Composer docs - referencing scripts.

javascript

{ "name": "acme/example", // ... "extra": { "package-scripts": { "all": ["@first", "@second", "@third"], "first": "echo first", "second": "echo second", "third": "echo third" } } }

Package scripts of other packages may be referenced using their full name or alias (if it exists). Using the full name should be preferred.

javascript

{ "name": "acme/example", // ... "extra": { "package-scripts": { "another-foo": "@acme:another:foo" } } }

Specifying aliases and help

Package script aliases and help can be defined in the composer.json's extra option.

javascript

{ "name": "acme/example", // ... "extra": { "package-scripts": { "hello-world": "echo Hello world!", "php-version": "php -v" }, "package-scripts-meta": { "hello-world": {"aliases": "hello", "help": "An example command"}, "php-version": {"aliases": ["phpv", "pv"], "help": "Show PHP version"} } } }

Unlike script names, aliases are not automatically prefixed by the package name.

The example above will define the following scripts:

Specifying aliases in the root package

If a package doesn't provide suitable aliases, the root package may define them in its scripts option.

javascript

{ "name": "acme/project", // ... "scripts": { "acme-hello": "@acme:example:hello-world" } }

Using variables

Unlike root scripts, package scripts may use variable placeholders.

The syntax of the placeholder is:

{$variable-name}

Composer configuration

All Composer configuration directives are available through variables.

See Composer docs - config.

javascript

{ "name": "acme/example", // ... "extra": { "package-scripts": { "list-vendors": "ls {$vendor-dir}" } } }

Package variables

Packages may define their own variables in the composer.json's extra option.

javascript

{ "name": "acme/example", // ... "extra": { "package-scripts": { "hello": "echo {$name}" }, "package-scripts-vars": { "name": "Bob" } } }

These defaults may then be overriden in the root package, if needed:

javascript

{ "name": "acme/project", // ... "extra": { "package-scripts-vars": { "acme/example": { "name": "John" } } } }

Referencing other variables

Package variables may reference composer configuration directives or other package variables belonging to the same package.

javascript

{ "name": "acme/example", // ... "extra": { "package-scripts": { "hello": "echo Hello {$names}", "show-paths": "echo {$paths}" }, "package-scripts-vars": { "names": ["Bob", "{$other-names}"], "other-names": ["John", "Nick"], "paths": ["{$vendor-dir}", "{$bin-dir}"] } } }

bash

composer acme:example:hello

> echo Hello "Bob" "John" "Nick"
Hello Bob John Nick


ash

composer acme:example:show-paths
> echo "/project/vendor" "/project/vendor/bin"
/project/vendor /project/vendor/bin

Running package scripts

Package scripts can be invoked the same way root scripts can:

  1. composer run-script acme:example:hello-world
  2. composer acme:example:hello-world

See Composer docs - running scripts manually.

Using package scripts in events

Package scripts may be used in event scripts (provided the plugin is loaded at that point).

javascript

{ "name": "acme/project", // ... "scripts": { "post-install-cmd": "@acme:example:hello-world" } }

Listing package scripts

This plugin provides a command called package-scripts:list, which lists both active and inactive package scripts and aliases.

bash

composer package-scripts:list

Available package scripts:
  acme:example:hello-world (hello)    An example command
  acme:example:php-version (phpv, pv) Show PHP version

Enabling verbose mode will show additonal information:

bash

composer package-scripts:list -v

Available package scripts:
  acme:example:hello-world Run the "hello-world" script from acme/example
   - package: acme/example
   - definition: "echo Hello world!"
   - aliases:
  acme:example:php-version Run the "php-version" script from acme/example
   - package: acme/example
   - definition: "php -v"
   - aliases:

You may use the psl alias instead of the full command name.

Debugging package scripts and variables

This plugin provides a command called package-scripts:dump, which dumps compiled scripts (including root scripts) or package script variables.

bash

composer package-scripts:dump

Specifying the --vars flag will dump compiled package script variables instead:

bash

composer package-scripts:dump --vars

You may use the psd alias instead of the full command name.


All versions of composer-pkg-scripts with dependencies

PHP Build Version
Package Version
Requires php Version >=7.1
ext-json Version *
composer-plugin-api Version ^1.1 || ^2.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 kuria/composer-pkg-scripts contains the following files

Loading the files please wait ....