fbraz3/php-cli

By fbraz3

•Updated 5 days ago

PHP command line, support all versions from 5.6 to 8.4. It also have phalcon framework tags.

Image
Languages & frameworks
Developer tools
0

10K+

fbraz3/php-cli repository overview

⁠Braz PHP Docker

The Braz PHP Docker project provides a set of Docker images tailored for various PHP environments and use cases.

It simplifies the process of setting up PHP development environments by offering pre-configured images for different frameworks and tools, such as Vanilla PHP, Composer, Symfony, WP-CLI, and Phalcon.

These images support multiple PHP versions and architectures, ensuring compatibility and flexibility for developers.

We also provide an AI generated DeepWiki Page⁠ with more technical information.

šŸ’” For a complete list of available images, please visit the PHP System Docs⁠ page.

⁠Table of Contents

⁠Usage

To use the images, you can pull them from Docker Hub and run them with your PHP scripts or commands. Here are some examples of how to use the images:

Docker ImageEntrypointCommand ExampleBuild Status
php-cli⁠/usr/bin/phpdocker run -v $pwd:/workspace --rm fbraz3/php-cli:8.4 myscript.phpBase Images
phalcon⁠/usr/bin/phpdocker run -v $pwd:/workspace --rm fbraz3/php-cli:8.4-phalcon myscript.phpPhalcon Images
php-composer⁠/usr/local/bin/composerdocker run -v $pwd:/workspace --rm fbraz3/php-composer:8.4 initBuild Composer Images
wp-cli⁠/usr/local/bin/wpdocker run -v $pwd:/workspace --rm fbraz3/wp-cli:8.4 plugin install bbpressWP-Cli Images
symfony-cli⁠/usr/local/bin/symfonydocker run -v $pwd:/workspace --rm fbraz3/symfony-cli:8.4 server:startSymfony Images

⁠Tags

Each image is tagged with the PHP version. For example:

  • fbraz3/php-cli:8.4 for PHP 8.4
  • fbraz3/php-cli:8.4-phalcon for PHP 8.4 with Phalcon extension
  • fbraz3/php-composer:8.4 for PHP 8.4 with Composer
  • fbraz3/symfony-cli:8.4 for PHP 8.4 with Symfony CLI
  • fbraz3/wp-cli:8.4 for PHP 8.4 with WP-CLI

⁠Flavors

This project includes the following flavors:

  • Vanilla PHP: A base PHP image with essential extensions and tools.
  • Composer: An image with Composer pre-installed for dependency management.
  • Symfony: An image with the Symfony CLI pre-installed for Symfony projects.
  • WP-CLI: An image with WP-CLI pre-installed for managing WordPress installations.
  • Phalcon: An image with the Phalcon PHP framework pre-installed.

Each flavor supports multiple PHP versions, ranging from 5.6 to 8.4, and is available for both amd64 and arm64 architectures.

⁠Permissions

The images are designed to run as the php user by default (uid 1000). If you need to run commands as the root user, you can use the --user flag when running the container.

If you need to write to a mounted volume, ensure that the php user has the necessary permissions. You can set the ownership of the mounted directory to the php user by running:

chown -R 1000:1000 /path/to/your/directory

A workaround for this is to chmod the mounted directory to 777 before running the container. This will allow all users to read, write, and execute files in that directory. However, this is not recommended for production environments due to security concerns.

There is another workaround for this running the container with the --user flag set to root, but this is also not recommended for production environments.

The default directory for the container is /workspace, but you can change it by setting the WORKDIR environment variable in your Dockerfile or when running the container.

⁠Sending Emails

All images have ssmtp pre-installed and configured to send emails. The default SMTP server is localhost on port 25. You can use the mail() function in PHP to send emails from the container.

It's recommended to change the default SMTP server to your own SMTP server. You can do this by setting the SMTP environment variable when running the container. For example:

docker run -v $pwd:/workspace -e SMTP_MAIL_SERVER=smtp.example.com -e SMTP_AUTH_USER=username -e SMTP_AUTH_PASSWORD=password --rm fbraz3/php-cli:8.4 mail_sending.php

ā€¼ļøNote: avoid setting the password in the command line, use a .env file instead.

For example, create a .env file with the following content:

SMTP_MAIL_SERVER=smtp.example.com
SMTP_AUTH_USER=username
SMTP_AUTH_PASSWORD=password

Then run the container with the --env-file option:

docker run -v $pwd:/workspace --env-file .env --rm fbraz3/php-cli:8.4 mail_sending.php

To validate all environment variables you can use for mail sending, please check the file ssmtp.sh⁠.

Is also recommended to refer to ssmtp documentation⁠ for more information about its configuration.

⁠Contribution

Contributions are welcome! Feel free to open issues or submit pull requests to improve the project.

Please visit the CONTRIBUTING.md⁠ file for guidelines on how to contribute to this project.

⁠Donation

I spend a lot of time and effort maintaining this project. If you find it useful, consider supporting me with a donation:

⁠License

This project is licensed under the Apache License 2.0⁠, so you can use it for personal and commercial projects. However, please note that the images are provided "as is" without any warranty or guarantee of any kind. Use them at your own risk.

Tag summary

Content type

Image

Digest

sha256:54371b000…

Size

228.5 MB

Last updated

5 days ago

docker pull fbraz3/php-cli:7.2-phalcon