Last active
May 12, 2021 19:19
-
-
Save Greg-Boggs/7c2f8a0be2e674ef375f29cb23f93e58 to your computer and use it in GitHub Desktop.
How to print a platformsh route for your environment in PHP
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| $projectId = getenv('PLATFORM_PROJECT'); | |
| // A JSON-encoded value. | |
| $projectId = getenv('PLATFORM_PROJECT'); | |
| // A JSON-encoded value. | |
| $routes = json_decode(base64_decode(getenv('PLATFORM_ROUTES')), TRUE); | |
| foreach ($routes as $route => $details) { | |
| echo $route; | |
| continue; | |
| } | |
| // Or alternatively after composer require platformsh/config-reader | |
| require __DIR__ . '/vendor/autoload.php'; | |
| use Platformsh\ConfigReader\Config; | |
| $config = new Config(); | |
| $route = $config->getPrimaryRoute(); | |
| echo $route; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment