定制 samojled/php-caddy 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

samojled/php-caddy

Composer 安装命令:

composer require samojled/php-caddy

包简介

A tiny php development environment for Windows

README 文档

README

Introduction

PHP Caddy is a tiny PHP development environment for Windows, inspired by Laravel Valet.

No hosts file, no configuration, no frills. Just run it and go write some code.

PHP Caddy is basically a stripped down Valet: no *.dev domain proxy (only localhost), no linking multiple sites or parked directories, and no sharing over local tunnels. It also doesn't require elevated privileges to run like some of the other Windows alternatives, which can make things easier for people in corporate environments.

Built with Caddy web server, PHP Caddy also includes Mailhog for catching email sent by your application.

This package is for minimalists. It does not have the full feature set of Valet, and it doesn't provide the robust features of a virtualized environment like Homestead.

  • If you are on macOS you should probably just use Laravel Valet because it's awesome.
  • If you want something more Valet-like for Windows, check out valet-windows.
  • If you want a fully virtualized Linux development environment, use Laravel Homestead.
  • If you're on Windows and you want a fast, easy to use local development environment with minimal resource consumption, read on!

Requirements

502 Bad Gateway

There seems to be an issue with long-running php-cgi.exe processes in PHP 7.0 and earlier on Windows. The process randomly crashes after a period of time, causing a 502 Bad Gateway in PHP Caddy.

PHP 7.1 introduced the ability to run multiple php-cgi.exe processes, which seems to alleviate this problem.

If you are getting frequent 502 Bad Gateway errors, try upgrading to PHP 7.1 and make sure you're running the latest PHP Caddy by running composer global update.

If you can't upgrade PHP, then you can restart PHP when this happens using caddy service php restart.

Installation instructions

composer global require samojled/php-caddy

Usage

Make sure your global composer vendor/bin folder is in your system path.

Start it up

cd {your php project directory}
caddy start

Shut it down

caddy stop

Switch directories (serve a different project)

cd {another php project}
caddy link

Control individual services

# Mailhog
caddy service mailhog start
caddy service mailhog stop
caddy service mailhog restart

# Http (Caddy)
caddy service http start
caddy service http stop
caddy service http restart

# PHP
caddy service php start
caddy service php stop
caddy service php restart

Available Commands

Command Description
caddy install Install PHP Caddy services
caddy link Link Caddy to the current directory
caddy start Start the Caddy services and Link the current directory.
caddy start --without-mailhog For a slightly lighter resource footprint
caddy stop Stop the Caddy services
caddy which Determine which Valet driver serves the current working directory
caddy uninstall Remove PHP Caddy services
caddy service [service] [command] Start/Stop/Restart individual services

Supported Frameworks and Applications

PHP Caddy comes with the same default set of drivers as Valet, so out of the box it supports:

  • Laravel
  • Lumen
  • Symfony
  • Zend
  • CakePHP 3
  • WordPress
  • Bedrock
  • Craft
  • Statamic
  • Jigsaw
  • Static HTML

Custom Valet Drivers

You can write your own Valet driver to support PHP applications not in the list above, in the same way you can with Laravel Valet.

When you install PHP Caddy, a ~/.phpcaddy/Drivers directory is created which contains a SampleValetDriver.php file you can use as a guide. To use your custom driver, either place it in the ~/.phpcaddy/Drivers directory, or in the root path of your project, and it will be picked up by PHP Caddy.

See more info on creating custom drivers in the Laravel Valet docs: Custom Valet Drivers

Upgrading

You can update PHP Caddy using the composer global update command. After upgrading, you may need to run caddy install to make any necessary configuration changes.

License and Attribution

Parts of the original Laravel Valet source code were used in whole or in part in building this project, and are covered under the original Valet License

The Caddy and Mailhog binaries are covered under their respective licenses.

PHP Caddy is Copyright (c) 2017 Dave Samojlenko and licensed under the MIT license

Powered by Caddy

samojled/php-caddy 适用场景与选型建议

samojled/php-caddy 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 202 次下载、GitHub Stars 达 29, 最近一次更新时间为 2017 年 02 月 02 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「windows」 「laravel」 「caddy」 「caddyserver」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 samojled/php-caddy 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 samojled/php-caddy 我们能提供哪些服务?
定制开发 / 二次开发

基于 samojled/php-caddy 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

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

GitHub 信息

  • Stars: 29
  • Watchers: 3
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2017-02-02