Skip to content

Instantly share code, notes, and snippets.

@andyshinn
Last active February 18, 2024 12:05
Show Gist options
  • Select an option

  • Save andyshinn/e2c428f2cd234b718239 to your computer and use it in GitHub Desktop.

Select an option

Save andyshinn/e2c428f2cd234b718239 to your computer and use it in GitHub Desktop.
Docker Compose PHP Composer Example
{
"require": {
"mfacenet/hello-world": "v1.*"
}
}
app:
restart: 'yes'
image: php:7
command: php -S 0.0.0.0:8000 /app/index.php
ports:
- "8000:8000"
volumes:
- .:/app
composer:
restart: 'no'
image: composer/composer:php7
command: install
volumes:
- .:/app
<?php
require 'vendor/autoload.php';
use HelloWorld\SayHello;
echo SayHello::world();
@jonathansanchez
Copy link
Copy Markdown

@andyshinn How does it work with PHP 7.2?

@andyshinn
Copy link
Copy Markdown
Author

Is there some error with PHP 7.2? I don't use PHP daily so I am not sure what the difference might be.

@samo29
Copy link
Copy Markdown

samo29 commented Feb 19, 2020

Perfect! thanks for share!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment