• Stars
    star
    224
  • Rank 177,221 (Top 4 %)
  • Language
    PHP
  • License
    MIT License
  • Created over 10 years ago
  • Updated 3 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

This is the legacy version of Platform.sh's command-line interface. The new version is at: https://github.com/platformsh/cli

The Legacy Platform.sh CLI is the legacy version of the command-line interface for Platform.sh. For the current Platform.sh CLI, check this repository.

Build Status License

Install

To install the CLI, use either Homebrew (on Linux, macOS, or the Windows Subsystem for Linux) or Scoop (on Windows):

HomeBrew

brew install platformsh/tap/platformsh-cli

Scoop

scoop bucket add platformsh https://github.com/platformsh/homebrew-tap.git
scoop install platform

Manual installation

For manual installation, you can also download the latest binaries.

Legacy installer

This installation method is considered legacy and is discouraged, use one of the methods above instead. Starting with version 5.x, this installation method will not be supported.

In order to use the Legacy installer, you need to have an operating system supported by PHP (Linux, OS X, or Windows) and PHP 5.5.9 or higher, with the following extensions: curl, json, pcre, and phar.

Run this command to install the CLI using the legacy installer, given that you have PHP already installed:

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

In some Windows terminals you may need php.exe instead of php.

Upgrade

Upgrade using the same tool:

HomeBrew

brew upgrade platformsh-cli

Scoop

scoop update platform

Usage

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

platform

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

platform list

Authentication

There are two ways to authenticate:

  1. The recommended way is platform login, which lets you log in via a web browser, including via third-party providers such as Google, GitHub, GitLab and Bitbucket.

  2. If using a browser is not possible, use an API token.

    An interactive command is available for this: platform auth:api-token-login

    For non-interactive uses such as scripts or CI systems, set the API token in an environment variable named PLATFORMSH_CLI_TOKEN. This can be insecure if not handled properly, although it is appropriate for systems such as CircleCI, Jenkins and GitLab.

    Warning: An API token can act as the account that created it, with no restrictions. Use a separate machine account to limit the token's access.

Customization

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

api:
  # Whether to disable the docker-credential-helpers credential storage method.
  # When enabled (default), and if supported, credentials are stored in:
  #   - OS X: the default keychain
  #   - Linux: the default collection in the Secret Service
  #   - Windows: the Credential Manager under "Generic Credentials"
  # When disabled or not supported, credentials are stored in a hidden file.
  disable_credential_helpers: false

application:
  # 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

  # A directory (relative to the home directory) where the CLI can write
  # user-specific files, for storing state, logs, credentials, etc.
  writable_user_dir: '.platformsh'

local:
  # 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

# Pagination settings.
#
# These only affect 2 commands for now: project:list and org:sub:list.
pagination:
    # Enable pagination. Can be disabled with --count 0.
    enabled: true
    # Items per page. Can be overridden with --count.
    count: 20

updates:
  # 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_DEFAULT_TIMEOUT: the timeout (in seconds) for most individual API requests. The default is 30.
  • PLATFORMSH_CLI_DISABLE_CACHE: set to 1 to disable caching
  • PLATFORMSH_CLI_HOME: override the home directory (inside which the .platformsh directory is stored)
  • PLATFORMSH_CLI_NO_COLOR: set to 1 to disable colors in output
  • PLATFORMSH_CLI_NO_INTERACTION: set to 1 to disable interaction (useful for scripting). Equivalent to the --no-interaction command-line option. Warning: this will bypass any confirmation questions.
  • PLATFORMSH_CLI_SESSION_ID: change user session (default 'default'). The session:switch command (beta) is now available as an alternative.
  • 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: An API token can act as the account that created it, with no restrictions. Use a separate machine account to limit the token's access. Additionally, storing a secret in an environment variable can be insecure. It may be better to use the auth:api-token-login command. 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
  • PLATFORMSH_CLI_AUTO_LOAD_SSH_CERT: set to 0 to disable automatic loading of an SSH certificate when running login or SSH commands
  • PLATFORMSH_CLI_REPORT_DEPRECATIONS: set to 1 to enable PHP deprecation notices (suppressed by default). They will only be displayed in debug mode (-vvv).
  • 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

Known issues

Caching

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).

Contributing

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

More Repositories

1

platformsh-docs

Platform.sh documentation. Templates available at https://github.com/platformsh-templates/
HTML
102
star
2

symfonyflex-bridge

Bridge library for running Symfony Flex on Platform.sh
PHP
30
star
3

platformsh-client-php

Platform.sh API client for PHP
PHP
25
star
4

config-reader-php

Configuration reader library for Platform.sh hosting - PHP version.
PHP
23
star
5

console-form

Simple Symfony Console interactivity
PHP
21
star
6

cli

The unified tool for managing your Platform.sh services from the command line.
Smarty
17
star
7

example-typo3

Starter kit for running TYPO3 on Platform.sh. Maintained by the TYPO3 Community Interest Group (CIG Platform.sh)
PHP
16
star
8

template-builder

Utilities to manage Platform.sh project templates
HTML
15
star
9

hugo-meilisearch

Hugo theme component to create MeiliSearch indexes
12
star
10

example-api-platform-reactjs

Symfony API Platform with ReactJS admin client example configuration for Platform.sh. Maintained by the Platform.sh team. http://platform.sh
PHP
11
star
11

config-reader-nodejs

Configuration reader library for Platform.sh hosting - Node.js version.
JavaScript
10
star
12

jax-rs-jakarta-security

Java
10
star
13

templates-external

Index of 3rd party project starter templates for Platform.sh
Python
9
star
14

platformsh-client-python

Client library for the Platform.sh API in Python
Python
9
star
15

platformsh-magento2-configuration

☠ DEPRECATED
PHP
9
star
16

laravel-bridge

Bridge library for running Laravel on Platform.sh
PHP
8
star
17

platformsh-client-js

Platform.sh API client library
TypeScript
8
star
18

config-reader-python

Configuration reader library for Platform.sh hosting - Python version.
Python
7
star
19

java-quick-start

Java Quick Start for Platform.sh. Maintained by the Platform.sh team.
Java
7
star
20

php-ffi

Examples of using PHP FFI with C and Rust on Platform.sh
PHP
6
star
21

admiral

Reference implementation fleet management tool for Platform.sh
PHP
4
star
22

fwp-prestashop

Prestashop
PHP
4
star
23

fwp-drupal-7

PHP
4
star
24

example-magento1

Platform.sh example for Magento 1.
PHP
4
star
25

language-examples

Basic examples of using various languages with Platform.sh.
Java
4
star
26

django-sanitizedb

JavaScript
4
star
27

examples

Platform.sh Example Projects
Python
3
star
28

php-filebeat-example

PHP
3
star
29

platformsh-nodejs-helper

Deprecated. Please use https://github.com/platformsh/config-reader-nodejs instead.
JavaScript
3
star
30

wordpress-performance

PHP
3
star
31

homebrew-tap

Ruby
3
star
32

awesome-platformsh

Curated list of awesome Platform.sh-related examples and code snippets
3
star
33

example-amphp

Platform.sh example for Amp/Aerys. For example purposes only.
PHP
3
star
34

source-operations

Python
3
star
35

apidays2018-workshop

Go
3
star
36

example-nodejs-microservices

A nodejs microservices example
JavaScript
2
star
37

snippets

Shell
2
star
38

example-drupalcommerce7

Drupal Commerce Kickstart example for Platform.sh. Maintained by the CommerceGuys team.
PHP
2
star
39

example-reactphp

A skeleton React PHP application for Platform.sh. For demonstration purposes only.
PHP
2
star
40

config-reader-java

Java
2
star
41

platformify

Get your project ready to be deployed in Platform.sh
Go
2
star
42

helidon-eclipse-microprofile

Java
2
star
43

fastly-service-cli

A CLI for modifying Fastly services.
Python
2
star
44

platformsh-rails-helper

A library to ease using rails on platform.sh. Much Magic. Very Alpha
Ruby
2
star
45

single-load-balancing-fallback

Sample Java application with Load Balancing using fallback at Platform.sh
Java
2
star
46

example-moodle

Moodle example for Platform.sh. For demonstration purposes only.
PHP
2
star
47

fwp-drupal

Drupal template for FWP
PHP
2
star
48

platformsh-oauth2-php

[needs update] PHP OAuth2 client library for Platform.sh
PHP
2
star
49

platformsh-client-java

Platform.sh API client for Java
2
star
50

gha-check-url

Checks a URL for a specific header response
1
star
51

example-craftcms

Craft CMS starter kit for Platform.sh.
PHP
1
star
52

colander-tools

A set of extensions for `colander`.
Python
1
star
53

fwp-wordpress

WordPress template for Orange Flexible Web Publisher
PHP
1
star
54

gha-template-pr-tests

Performs a series of tests on the pull request environment for a pull request
1
star
55

gha-retrieve-psh-prenv-url

Polls the GitHub Status API endpoint for a Pull Request external integration until success is posted, and returns the value for target_url.
1
star
56

micronaut

Micronaut samples supported by Platform.sh
Java
1
star
57

demo-project

TypeScript
1
star
58

config-reader-go

Configuration reader library for Platform.sh hosting - Go version.
Go
1
star
59

public-api-docs

DEPRECATED: Use https://api.platform.sh/docs/
1
star
60

mercure-rocks-example

HTML
1
star
61

gha-prep-for-autopr

Preps a repository to allow for auto-merging of pull requests.
1
star
62

payara-micro

Payara Micro samples supported by Platform.sh
Java
1
star
63

example-java-spring-gradle

A basic Java Spring application for Platform.sh, built using Gradle. Beta.
Java
1
star
64

example-r

An example repository for running R on Platform.sh using Miniconda/Anaconda
Shell
1
star
65

starter-builder

CSS
1
star
66

platformsh-ruby-helper

Platform.sh helper gem to ease interacting with the environment
Ruby
1
star
67

slides-template

Template for Reveal.js slides for Platform.sh.
JavaScript
1
star
68

gohelper

Go
1
star
69

demos-platform-sh

Platform.sh demonstration slide decks to show how cool Platform.sh is.
JavaScript
1
star
70

example-tomcat

Shell
1
star
71

example-netcore

.net core example for Platform.sh
C#
1
star
72

demo-drupal-blackfire

Integrate with Blackfire for demo purposes.
PHP
1
star
73

strapiconf2022

JavaScript
1
star