PHPackages                             totten/amp - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [CLI &amp; Console](/categories/cli)
4. /
5. totten/amp

ActiveLibrary[CLI &amp; Console](/categories/cli)

totten/amp
==========

CLI Interface to \*AMP-style stacks

0.8.2(3mo ago)791915[12 issues](https://github.com/amp-cli/amp/issues)AGPL-3.0PHPPHP &gt;=7.4CI passing

Since Dec 30Pushed 3mo ago2 watchersCompare

[ Source](https://github.com/amp-cli/amp)[ Packagist](https://packagist.org/packages/totten/amp)[ Docs](https://github.com/totten/amp)[ RSS](/packages/totten-amp/feed)WikiDiscussions master Synced 4d ago

READMEChangelogDependencies (9)Versions (44)Used By (0)

Download
--------

[](#download)

```
sudo curl -LsS https://download.civicrm.org/amp/amp.phar -o /usr/local/bin/amp
sudo chmod +x /usr/local/bin/amp

```

Build and Test
--------------

[](#build-and-test)

The build and test processes are based on `composer`, `phpunit`, and `box`.

To facilitate local development and testing with multiple versions of `php` and `mysqld` (on Linux and macOS), the repo includes a few helpers: `default.nix`, `./scripts/run-tests.sh`, and `./scripts/run-build.sh`. These helper scripts require the [nix package manager](https://nixos.org/nix/). Usage:

```
## Get the code
git clone https://github.com/amp-cli/amp
cd amp

## Start a shell with php+composer
nix-shell

## Run the test suites
./scripts/run-tests.sh

## Run the build, creating "dist/amp.phar"
./scripts/run-build.sh

```

About `amp`: Vision
-------------------

[](#about-amp-vision)

`amp` is a tool to facilitate development of PHP web applications. The goal is to complement `composer` (and similar tools) by adding a (mostly) automated step to setup the database and webserver for newly downloaded code. For example, a developer checking out a project might say:

```
me@localhost:~/src$ composer create-project example/my-application --dev
me@localhost:~/src$ cd my-application
me@localhost:~/src/my-application$ ./bin/amp create --url=http://localhost:8003
URL: http://localhost:8003
Admin User: admin
Admin Password zFWx9D22

```

The `my-application` package depends on the `amp` package (using `require-dev` or `suggest`). The `amp create` step creates a new database in the local mysqld and a new virutal-host in the local httpd; then it writes out necessary credentials (eg the mysql username and password) to a config file.

Additional thoughts:

- `amp` IS NOT a complete stack with bundled binaries (for PHP, MySQL, etc).
- `amp` IS NOT a cluster-management tool for remote servers.
- `amp` IS NOT a one-click installer.
- `amp` IS NOT a system-administration suite.
- `amp` is primarily AN INTERFACE to the local \*AMP stack -- it aims to help application developers write their own install scripts.
- `amp` aims to be PORTABLE -- to work with common PHP development environments such as Debian/Ubuntu, MAMP, XAMPP, or MacPorts.
- `amp` is designed for DEVELOPMENT AND TESTING. If you need to automatically install copies of applications from source-code in a variety of environments (for integration-tests, test-fixtures, demos, bug-fixing, training, collaboration, etc), then `amp` can help.

About `amp`: Pre-Alpha Example
------------------------------

[](#about-amp-pre-alpha-example)

At time of writing, `amp` is in-development and doesn't fully meet its vision. In the third line, the developer shouldn't call `amp create` directly; rather, the author of `my-application` should include an `install.sh` script, and the downstream developer can run it:

```
me@localhost:~/src$ composer create-project example/my-application --dev
me@localhost:~/src$ cd my-application
me@localhost:~/src/my-application$ ./bin/amp config
me@localhost:~/src/my-application$ ./bin/install.sh
Login to the application:
 * URL: ${AMP_URL}
 * Username: admin
 * Password: default

```

The `amp config` command determines how to connect to MySQL and httpd. It may scan the local system for common configurations (Ubuntu vs MAMP vs MacPorts; Apache vs nginx), prompt the user for information, and retain the info (in ~/.amp) for future use.

The `install.sh` is mostly specific to the application, but it builds on `amp` to address the tedious bit about setting up mysqld and httpd. For example, one might say:

```
#!/bin/bash
set -e
APPDIR=`pwd`

## Create a new database and virtual-host
eval $(amp create --root="$APPDIR/web")
amp datadir "$APPDIR/log" "$APPDIR/cache"

## Load DB
cat $APPDIR/sql/install.sql | mysql -u$AMP_DB_USER -p$AMP_DB_PASS $AMP_DB_NAME

## Create config file
cat > $APPDIR/conf/my-application.ini
