Download the PHP package asm/php-ansible without Composer

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

php-ansible library

Build PHP 8.0/8.1/8.2

This library is a OOP-wrapper for the ansible provisioning tool. I intend to use this library for a symfony2 bundle and also a deployment GUI, based on php/symfony2. The current implementation is feature-complete for the ansible-playbook and ansible-galaxy commands.

Prerequisites

Your OS should be a flavor of linux and ansible has to be installed. It's easiest if ansible is in PATH :-) The library tries to find ansible-playbook and ansible-galaxy by itself or use the paths/executables you provide.

Usage

First instantiate the base object which works as a factory for the commands. Only the first parameter is mandatory, and provides the library with the path to your ansible deployment file structure.

Optionally, you can specify the path of your ansible-playbook and ansible-galaxy commands, just in case they are not in the PATH.

You can also pass any PSR compliant logging class to have further details logged. This is especially useful to have the actual run command logged.

Playbooks

Then you can use the object just like in your previous ansible deployment. If you don't specify an inventory file with , the wrapper tries to determine one, based on your playbook name:

This will create following ansible command:

For the execute command you can use a callback to get real-time output of the command:

If no callback is given, the method will return the ansible-playbook output as a string, so you can either or directly pipe it into a log/whatever.

You can also pass an external YML/JSON file as extraVars containing a complex data structure to be passed to Ansible:

You can have a Json output adding json() option that enable 'ANSIBLE_STDOUT_CALLBACK=json' env vars to make a json output in ansible.

Galaxy

The syntax follows ansible's syntax with one deviation: list is a reserved keyword in php (array context) and therefore I had to rename it to "modulelist()".

would generate:

You can access all galaxy commands:

You can combine the calls with their possible arguments, though I don't have any logic preventing e.g. from being applied to e.g. info().

Possible arguments/options:

Process timeout

Default process timeout is set to 300 seconds. If you need more time to execute your processes: Adjust the timeout :-)

Thank you for your contributions!

thank you for reviewing, bug reporting, suggestions and PRs :-) xabbuh, emielmolenaar, saverio, soupdiver, linaori, paveldanilin and many others!

Future features

The Next steps for implementation are:

License

php-ansible is licensed under the MIT license. See the LICENSE for the full license text.


All versions of php-ansible with dependencies

PHP Build Version
Package Version
Requires php Version ^8.0.0|^8.1.0|^8.2.0
psr/log Version ^1.1|^2.0|^3.0
symfony/process Version ^5.3|^6.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 asm/php-ansible contains the following files

Loading the files please wait ....