shanginn/som
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 applicationsom up -d- Start the application in the backgroundsom stop- Stop the applicationsom restart- Restart the applicationsom ps- Display the status of all containers
Symfony Console Commands
som console ...- Run a Symfony console command
PHP Commands
som php ...- Run a PHP snippetsom php -v- Show PHP version
Composer Commands
som composer ...- Run a Composer commandsom 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 commandsom phpunit ...- Run PHPUnitsom pest ...- Run Pest
Container CLI
som shell- Start a shell session within the application containersom bash- Alias for 'som shell'som root-shell- Start a root shell session within the application containersom 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.
shanginn/som 适用场景与选型建议
shanginn/som 是一款 基于 Shell 开发的 Composer 扩展包,目前已累计 5.82k 次下载、GitHub Stars 达 1, 最近一次更新时间为 2023 年 08 月 27 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 shanginn/som 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 shanginn/som 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 5.82k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 9
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2023-08-27
