jtrw/php-make
Composer 安装命令:
composer require jtrw/php-make
包简介
Simple collections of make commands to increase productivity. This package gives you make commands to run your project easily. You can also customize the make commands to fit your project needs. Make commands o help work with docker, git, composer, migrations symfony, migrations laravel, tests, stat
README 文档
README
Useful PHP Makefile for PHP projects. Why Makefile? Because it's simple and easy to use and it's a standard tool for Unix systems. Simple collections of make commands to increase productivity. In this project I collect useful commands for PHP projects. Most of the commands are related to Docker projects.
Install
composer require jtrw/php-make- Run
/vendor/bin/php-makecommand for copy template Makefile to your project if Makefile exists it will be not overwritten. - If you use your own Makefile, you can add the following line to your Makefile:
include vendor/jtrw/php-make/.make/utils.mk include vendor/jtrw/php-make/.make/colours.mk include vendor/jtrw/php-make/.make/docker-compose-shared-services.mk include vendor/jtrw/php-make/.make/composer.mk include vendor/jtrw/php-make/.make/static-analysis.mk include vendor/jtrw/php-make/.make/migrations-symfony.mk
- Add to your .env file variable
PHP_FPM_NAMEandAPP_ENVfor example:
PHP_FPM_NAME=php-fpm APP_ENV=dev
- Use
make helpto see all available commands.
Usage
Description
File composer.mk contains commands for composer.
File docker.mk contains commands for docker.
File migrations-symfony.mk contains commands for Symfony migrations.
File migrations-laravel.mk contains commands for Laravel migrations.
File static-analysis.mk contains commands for static analysis.
File utils.mk contains useful commands.
File docker-compose-shared-services.mk contains commands for docker-compose. Shared services docker-compose-shared-services.yml it is a file with shared services for docker-compose. For example it's services that use in local development environment.
Example of docker-compose-shared-services.yml:
version: "3.7" services: mysql: container_name: ${APP_COMPOSE_PROJECT_NAME}_mysql image: mysql:8.0 networks: - backend cap_add: - SYS_NICE restart: always volumes: - mysql:/var/lib/mysql ports: - 3306:3306 env_file: - .env command: --sql_mode=STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION rabbitmq3: container_name: ${APP_COMPOSE_PROJECT_NAME}_rabbitmq image: rabbitmq:3.11.4-management-alpine networks: - backend environment: RABBITMQ_DEFAULT_USER: ${RABBITMQ_USER} RABBITMQ_DEFAULT_PASS: ${RABBITMQ_PASS} ports: - '5674:5672' - '15674:15672' redis: container_name: ${APP_COMPOSE_PROJECT_NAME}_redis image: redis:latest networks: - backend volumes: - ./.docker/redis/redis-cache/redis.conf:/usr/local/etc/redis/redis.conf - redis:/data command: /usr/local/etc/redis/redis.conf ports: - 6381:6379 healthcheck: test: [ "CMD", "bash", "-c", "exec 3<> /dev/tcp/127.0.0.1/6379 && echo PING >&3 && head -1 <&3 | grep PONG" ] interval: 5s timeout: 10s retries: 5 environment: REDIS_PASSWORD: ${APP_REDIS_PASSWORD} REDIS_PORT: ${APP_REDIS_PORT} networks: backend: name: backend driver: bridge volumes: mysql: redis:
And main file docker-compose.yml:
version: "3.7" services: nginx: container_name: ${APP_COMPOSE_PROJECT_NAME}_nginx build: context: ./.docker/nginx networks: - backend working_dir: /app volumes: - ./:/app ports: - '${APP_PORT:-9505}:80' php-fpm: container_name: ${APP_COMPOSE_PROJECT_NAME}_php_fpm build: context: ./.docker/php${PHP_VER}-${APP_ENV} networks: - backend env_file: - .env user: ${UID:-1000}:${GID:-1000} extra_hosts: - 'host.docker.internal:host-gateway' volumes: - ~/.composer/cache/:/.composer_cache/:rw - ./:/app:rw working_dir: /app tasks: container_name: ${APP_COMPOSE_PROJECT_NAME}_tasks build: context: ./.docker/php${PHP_VER}-${APP_ENV}-cli networks: - backend env_file: - .env user: ${UID:-1000}:${GID:-1000} extra_hosts: - 'host.docker.internal:host-gateway' volumes: - ./:/app:rw working_dir: /app restart: always command: '/usr/bin/supervisord' networks: backend: name: backend driver: bridge
In this case, you can use make shared-service-start to start shared services and make shared-service-stop to stop shared services.
or simple command make start-all to start all services.
License
The MIT License (MIT). Please see License File for more information.
jtrw/php-make 适用场景与选型建议
jtrw/php-make 是一款 基于 Makefile 开发的 Composer 扩展包,目前已累计 3.52k 次下载、GitHub Stars 达 7, 最近一次更新时间为 2024 年 10 月 16 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 jtrw/php-make 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 jtrw/php-make 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 3.52k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 7
- 点击次数: 11
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2024-10-16
