extremesensio/psh-route-reader

Help reading the *_ROUTES env var in a Platform.sh env

v1.0.0 2018-05-21 15:01 UTC

This package is auto-updated.

Last update: 2023-11-29 02:49:26 UTC


README

Little library parsing and querying the Platform.sh routes.

Setup

$ composer require extremesensio/psh-route-reader

Usage

When deploying on a PaaS, you might need to get the full URL where your app gets deployed, e.g. Wordpress needs it to handled multi-domain configuration.

On Platform.sh or Sensiocloud these are available in an environment variable. This library allows to easily query these, and their details, without having to parse the environment variable.

use Sensio\PshRouteReader\RouteReader;

$routeReader = new RouteReader();
$route = $routeReader->findOneByUpstream('app');

echo $route['full_url']; // "http://www.sensiogrey.com"

On Sensiocloud

use Sensio\PshRouteReader\RouteReader;

$routeReader = RouteReader::onSensiocloud();
$route = $routeReader->findOneByUpstream('app');

echo $route['full_url']; // "http://www.sensiogrey.com"