承接 shanginn/som 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

shanginn/som

最新稳定版本:1.3.0

Composer 安装命令:

composer require shanginn/som

包简介

CLI tool to interact with PHP app inside docker compose env

README 文档

README

som is a command-line utility for interacting with Symfony applications (now I'm working with API platform) running on Docker Compose. It provides a number of useful commands for managing your application and makes it easy to run Symfony, PHP, Composer and Docker Compose commands without manual docker command hassle.

Inspired by Laravel's sail tool, som aims to provide similar functionality, but designed specifically for Symfony based projects.

System Requirements

  • Docker and Docker Compose
  • bash
  • jq (optional, for shorthand Composer script commands)

Installation

composer require --dev shanginn/som

som is a bash and it will be placed inside vendor/bin folder. You can use it directly from there, but it's recommended to make a symlink:

ln -s vendor/bin/som som

Usage

som COMMAND [options] [arguments]

Unknown commands are passed directly to the Docker Compose.

Docker Compose Commands

  • som up - Start the application
  • som up -d - Start the application in the background
  • som stop - Stop the application
  • som restart - Restart the application
  • som ps - Display the status of all containers

Symfony Console Commands

  • som console ... - Run a Symfony console command

PHP Commands

  • som php ... - Run a PHP snippet
  • som php -v - Show PHP version

Composer Commands

  • som composer ... - Run a Composer command
  • som run ... - Run a Composer script (equivalent to "composer run")

If you have 'jq' installed and your composer.json has, for example, 'fix' script, you can run:

  • som fix

If composer.json not in the current dir set COMPOSER_JSON_PATH env

Running Tests

  • som test - Run PHPUnit tests via the Artisan test command
  • som phpunit ... - Run PHPUnit
  • som pest ... - Run Pest

Container CLI

  • som shell - Start a shell session within the application container
  • som bash - Alias for 'som shell'
  • som root-shell - Start a root shell session within the application container
  • som root-bash - Alias for 'som root-shell'
  • TODO: som psysh - Start a new psysh session

Binaries

  • som bin ... - Run Composer binary scripts from the vendor/bin directory

Help

  • som help - Show help information

Environment Variables

Environment variables can be defined in your .env file. The following variables are used by the SOM script:

  • HTTP_PORT: The HTTP port for your application (default: 80)
  • HTTPS_PORT: The HTTPS port for your application (default: 443)
  • HTTP3_PORT: The HTTP3 port for your application (default: 443)
  • DOCKER_PHP_SERVICE: The Docker service name for PHP (default: "php")
  • DOCKER_DB_SERVICE: The Docker service name for the database (default: "database")
  • DOCKER_WEB_SERVER_SERVICE: The Docker service name for the web server (default: "caddy")
  • DB_PORT: The database port (default: 5432)
  • USER: The user ID for the Docker container (default: UID of the current user)
  • GROUP: The group ID for the Docker container (default: GID of the current user)
  • DOCKER_COMPOSE_FILES: The Docker Compose file paths (separated by a colon if multiple files, ex DOCKER_COMPOSE_FILES="docker-compose.yml:docker-compose.prod.yml")
  • COMPOSER_JSON_PATH: The path to the composer.json file (default: "composer.json")

Contributing

Contributions are welcome! Please submit a pull request or create an issue to discuss the changes you want to make.

统计信息

  • 总下载量: 4.89k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 1
  • Forks: 1
  • 开发语言: Shell

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-08-27