💻 The unified tool for managing your Platform.sh services from the command line.
Clone or download
pjcdawkins Fix incorrect "You cannot use both the <environment> argument and the…
… --environment option" error in environment:activate command
Latest commit 4e0e8f2 Jan 9, 2019
Type Name Latest commit message Commit time
Failed to load latest commit information.
bin Simplify error control; stop displaying two exceptions on bad connection Mar 26, 2017
dist Remove interactivity check from installer (#765) Jan 4, 2019
resources [bot] add --party and --parrot options Mar 30, 2018
scripts/test Fix installer test script to use correct manifest Sep 10, 2018
src Fix incorrect "You cannot use both the <environment> argument and the… Jan 9, 2019
tests Fix: environments with an empty name (e.g. '0') not being recognized Jan 8, 2019
.editorconfig Added an editorconfig file to keep IDEs properly behaved. Jul 12, 2016
.gitignore [self:release] Support editing the changelog [skip changelog] Mar 1, 2018
.travis.yml Run tests in PHP 7.3 (Travis) (#764) Dec 28, 2018
CONTRIBUTING.md Test the installer via Travis Sep 9, 2018
LICENSE Initial commit. Feb 13, 2014
README.md Update README.md [skip changelog] Jan 8, 2019
box.json Box syntax simplification Sep 25, 2018
composer.json Allow restoring snapshots to another environment (#735) Jan 9, 2019
composer.lock Allow restoring snapshots to another environment (#735) Jan 9, 2019
config.yaml Parse project URLs from the beta unified-UI (#761) Dec 15, 2018
constants.php Refactor config and API methods Apr 5, 2016
phpunit.xml Start automated tests Nov 13, 2014
services.yaml Allow loading more than 10 snapshots via --limit (#758) Nov 27, 2018
shell-config-bash.rc Fix "p" alias in shell-config-bash.rc Sep 27, 2018
shell-config.rc Refactor shell config into separate files Dec 27, 2017
stub.php Remove shebang hack for portability Dec 25, 2016


The Platform.sh CLI is the official command-line interface for Platform.sh. Use this tool to interact with your Platform.sh projects, and to build them locally for development purposes.

Build Status License


  • Operating system: Linux, OS X, Windows Vista, Windows 7, Windows 8 Pro, or Windows 10 (Windows 8 Standard does not work due to an issue with symlink permissions)
  • PHP 5.5.9 or higher, with cURL support
  • Git
  • A Bash-like shell:
    • On OS X or Linux/Unix: SH, Bash, Dash or ZSH - usually the built-in shell will work.
    • On Windows: Windows Subsystem for Linux (recommended), or another Bash-compatible shell such as Git Bash, Cygwin, or MinGW.
  • For building locally, your project's dependencies, e.g.


Installing on OS X or Linux

This is the recommended installation method. Simply use this command:

curl -sS https://platform.sh/cli/installer | php

Installing on Windows (Git bash)

curl https://platform.sh/cli/installer -o cli-installer.php
php cli-installer.php

Installing manually

  1. Download the platform.phar file from the latest release.

  2. Rename the file to platform, ensure it is executable, and move it into a directory in your PATH (use echo $PATH to see your options).

  3. Enable autocompletion and shell aliases:

     platform self:install


New releases of the CLI are made regularly. Update with this command:

platform self:update


You can run the Platform.sh CLI in your shell by typing platform.


Use the 'list' command to get a list of available options and commands:

platform list


The current output of platform list is as follows:

Platform.sh CLI

Global options:
  --help           -h Display this help message
  --quiet          -q Do not output any message
  --verbose        -v|vv|vvv Increase the verbosity of messages
  --version        -V Display this application version
  --yes            -y Answer "yes" to all prompts; disable interaction
  --no             -n Answer "no" to all prompts

Available commands:
  clear-cache (clearcache, cc)              Clear the CLI cache
  docs                                      Open the online documentation
  help                                      Displays help for a command
  list                                      Lists commands
  multi                                     Execute a command on multiple projects
  web                                       Open the Web UI
  activity:get                              View detailed information on a single activity
  activity:list (activities)                Get a list of activities for an environment or project
  activity:log                              Display the log for an activity
  app:config-get                            View the configuration of an app
  app:list (apps)                           List apps in the project
  auth:browser-login (login)                Log in to Platform.sh via a browser
  auth:info                                 Display your account information
  auth:logout (logout)                      Log out of Platform.sh
  auth:password-login                       Log in to Platform.sh using a username and password
  certificate:add                           Add an SSL certificate to the project
  certificate:delete                        Delete a certificate from the project
  certificate:get                           View a certificate
  certificate:list (certificates, certs)    List project certificates
  commit:get                                Show commit details
  commit:list (commits)                     List commits
  db:dump                                   Create a local dump of the remote database
  db:size                                   Estimate the disk usage of a database
  db:sql (sql)                              Run SQL on the remote database
  domain:add                                Add a new domain to the project
  domain:delete                             Delete a domain from the project
  domain:get                                Show detailed information for a domain
  domain:list (domains)                     Get a list of all domains
  domain:update                             Update a domain
  environment:activate                      Activate an environment
  environment:branch (branch)               Branch an environment
  environment:checkout (checkout)           Check out an environment
  environment:delete                        Delete an environment
  environment:drush (drush)                 Run a drush command on the remote environment
  environment:http-access (httpaccess)      Update HTTP access settings for an environment
  environment:info                          Read or set properties for an environment
  environment:list (environments)           Get a list of environments
  environment:logs (log)                    Read an environment's logs
  environment:merge (merge)                 Merge an environment
  environment:push (push)                   Push code to an environment
  environment:redeploy (redeploy)           Redeploy an environment
  environment:relationships (relationships) Show an environment's relationships
  environment:ssh (ssh)                     SSH to the current environment
  environment:synchronize (sync)            Synchronize an environment's code and/or data from its parent
  environment:url (url)                     Get the public URLs of an environment
  integration:add                           Add an integration to the project
  integration:delete                        Delete an integration from a project
  integration:get                           View details of an integration
  integration:list (integrations)           View a list of project integration(s)
  integration:update                        Update an integration
  integration:validate                      Validate an existing integration
  local:build (build)                       Build the current project locally
  local:dir (dir)                           Find the local project root
  local:drush-aliases (drush-aliases)       Find the project's Drush aliases
  mount:download                            Download files from a mount, using rsync
  mount:list (mounts)                       Get a list of mounts
  mount:size                                Check the disk usage of mounts
  mount:upload                              Upload files to a mount, using rsync
  project:clear-build-cache                 Clear a project's build cache
  project:create (create)                   Create a new project
  project:delete                            Delete a project
  project:get (get)                         Clone a project locally
  project:info                              Read or set properties for a project
  project:list (projects)                   Get a list of all active projects
  project:set-remote                        Set the remote project for the current Git repository
  repo:cat                                  Read a file in the project repository
  repo:ls                                   List files in the project repository
  route:get                                 View a resolved route
  route:list (routes)                       List all routes for an environment
  self:install                              Install or update CLI configuration files
  self:update (self-update)                 Update the CLI to the latest version
  server:list (servers)                     List running local project web server(s)
  server:run                                Run a local PHP web server
  server:start                              Run PHP web server(s) for the local project
  server:stop                               Stop local project web server(s)
  service:list (services)                   List services in the project
  service:mongo:dump (mongodump)            Create a binary archive dump of data from MongoDB
  service:mongo:export (mongoexport)        Export data from MongoDB
  service:mongo:restore (mongorestore)      Restore a binary archive dump of data into MongoDB
  service:mongo:shell (mongo)               Use the MongoDB shell
  service:redis-cli (redis)                 Access the Redis CLI
  snapshot:create                           Make a snapshot of an environment
  snapshot:list (snapshots)                 List available snapshots of an environment
  snapshot:restore                          Restore an environment snapshot
  ssh-key:add                               Add a new SSH key
  ssh-key:delete                            Delete an SSH key
  ssh-key:list (ssh-keys)                   Get a list of SSH keys in your account
  tunnel:close                              Close SSH tunnels
  tunnel:info                               View relationship info for SSH tunnels
  tunnel:list (tunnels)                     List SSH tunnels
  tunnel:open                               Open SSH tunnels to an app's relationships
  user:add                                  Add a user to the project
  user:delete                               Delete a user from the project
  user:get                                  View a user's role(s)
  user:list (users)                         List project users
  user:update                               Update user role(s) on a project
  variable:create                           Create a variable
  variable:delete                           Delete a variable
  variable:get (vget)                       View a variable
  variable:list (variables)                 List variables
  variable:update                           Update a variable
  worker:list (workers)                     Get a list of all deployed workers

Known issues


The CLI caches details of your projects and their environments, and some other information. These caches could become out-of-date. You can clear caches with the command platform clear-cache (or platform cc for short).


There are currently three ways to authenticate:

  1. platform login (AKA platform auth:browser-login): this opens a temporary local server and a browser, allowing you to log in to Platform.sh via the normal login form, including via services like Bitbucket, GitHub and Google.

  2. platform auth:password-login: this allows you to log in with a username and password, and a two-factor token if applicable.

  3. API tokens: these allow non-interactive authentication. See Customization below for how to use an API token. Remember to use a separate machine account if you want to limit the token's access.


You can configure the CLI via the user configuration file ~/.platformsh/config.yaml. These are the possible keys, and their default values:

  # A path (relative or absolute) to a file containing an API token.
  # The file should be stored with minimal permissions.
  # Run 'platform logout --all' if you change this value.
  token_file: null

  # The method used for interactive login: 'browser' or 'password' (defaults to
  # 'browser').
  login_method: browser

  # The default timezone for times displayed or interpreted by the CLI.
  # An empty (falsy) value here means the PHP or system timezone will be used.
  # For a list of timezones, see: http://php.net/manual/en/timezones.php
  timezone: ~

  # The default date format string, for dates and times displayed by the CLI.
  # For a list of formats, see: http://php.net/manual/en/function.date.php
  date_format: c

  # Set this to true to avoid some Windows symlink issues.
  copy_on_windows: false

  # Configure the Drush executable to use (defaults to 'drush').
  drush_executable: null

  # Whether to check for automatic updates.
  check: true

  # The interval between checking for updates (in seconds). 604800 = 7 days.
  check_interval: 604800

Other customization is available via environment variables:

  • PLATFORMSH_CLI_DEBUG: set to 1 to enable cURL debugging. Warning: this will print all request information in the terminal, including sensitive access tokens.
  • PLATFORMSH_CLI_DISABLE_CACHE: set to 1 to disable caching
  • PLATFORMSH_CLI_NO_COLOR: enable (set to 1) to force colorized output off
  • PLATFORMSH_CLI_SESSION_ID: change user session (default 'default')
  • PLATFORMSH_CLI_SHELL_CONFIG_FILE: specify the shell configuration file that the installer should write to (as an absolute path). If not set, a file such as ~/.bashrc will be chosen automatically. Set this to an empty string to disable writing to a shell config file.
  • PLATFORMSH_CLI_TOKEN: an API token. Warning: storing a secret in an environment variable can be insecure. It may be better to use config.yaml as above, depending on your system. The environment variable is preferable on CI systems like Jenkins and GitLab.
  • PLATFORMSH_CLI_UPDATES_CHECK: set to 0 to disable the automatic updates check
  • CLICOLOR_FORCE: set to 1 or 0 to force colorized output on or off, respectively
  • http_proxy or https_proxy: specify a proxy for connecting to Platform.sh


See CONTRIBUTING.md for how to contribute to the CLI.