定制 thisisdevelopment/laravel-base 二次开发

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

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

thisisdevelopment/laravel-base

Composer 安装命令:

composer create-project thisisdevelopment/laravel-base

包简介

Opinionated Laraval base install

README 文档

README

An opinionated base laravel install.

Install

composer create-project thisisdevelopment/laravel-base <dir>

Or alternatively if you don't have composer installed locally:

dir=<dir>
git clone https://github.com/thisisdevelopment/laravel-base $dir
cd $dir
rm -rf .git
./bin/dev init

Folder structure

This is modeled after the domain oriented structure proposed by sticher.io: https://stitcher.io/blog/laravel-beyond-crud-01-domain-oriented-laravel The proposed structure is extended with the concept of modules, which are default implementations of generic domain code.

The complete structure is

  • app <= toplevel app dir, no code here
  • app/App/<app name>/ <= application specific code
  • app/Domain/<domain> <= domain specific code
  • app/Domain/vendor/<domain> <= generic domain code (managed by composer, for packages with type=laravel-domain)
  • app/Module/<module> <= module code (managed by composer, for packages with type=laravel-module)
  • packages/<package>/ <= composer wil automatically pickup any packages in this directory. This allows to develop packages alongside your application (see packages/README.md)

It uses oomphinc/composer-installers-extender to install packages of type laravel-module/laravel-domain to the app/Module and app/Domain/vendor folders.

Docker compose support

This base install comes with a complete docker-compose setup out of the box. It assumes you have a working local docker install which allows access to docker for your own user.

To easily access the containers you should also run the thisisdevelopment/docker-hoster container (see https://github.com/thisisdevelopment/docker-hoster) to dynamically update your hosts file.

docker run --restart=unless-stopped -d \
    -v /var/run/docker.sock:/tmp/docker.sock \
    -v /etc/hosts:/tmp/hosts \
    thisisdevelopment/docker-hoster

Dev script

To easily access the containers you should use the included bin/dev script. This script allows for easy execution of composer etc inside your containers.

The supported commands are:

  • up
  • down
  • rm
  • deploy
  • logs
  • php-cli
  • composer
  • artisan
  • phpcs
  • phpcbf
  • phpunit

Coding standards

This base install enforces the PSR-12 code standard. It does this by installing a git-hook which enforces this standard (by means of phpcs)

SSL/HTTPS

Linux

To enable HTTPs on (Ubuntu) Linux, the following steps need to be performed.

  • generate local development certificate
  • rename app-hostname.
  • add nginx reverse proxy to docker-compose

To generate a certificate you'll need the tool mkcert (to generate the certificate) and libnss3-tools to automatically register this certificate in your browser (Firefox/Chrome). e.g. apt-get install mkcert libnss3-tools.

When installed, we can generate the certificate by running the following commands from project root, where app.services.docker needs to be replaced with the value from your .env's APP_DOMAIN.

mkcert -key-file ./docker/services/app/certs/ssl.key -cert-file ./docker/services/app/certs/ssl.crt app.services.docker

Next, we need to add an additional service to the docker-stack, allowing us to use SSL. If not present already, create a docker-compose.override.yml at project root, and add the following.

services:
  nginx:
    image: nginx:latest
    hostname: $APP_DOMAIN
    depends_on:
      - app
    volumes:
      - ./docker/services/app/certs/:/etc/nginx/ssl
      - ./docker/services/app/nginx-ssl.conf:/etc/nginx/conf.d/app.services.docker.conf

  app:
    hostname: "" # this needs to be set to empty (or anything not APP_DOMAIN) to prevent collision with new nginx

Now you'll need to restart the entire stack with a ./bin/dev down && ./bin/dev up. At this point the app should be available through https on the original domain.

Mac

Probably the easiest way to get https working is by using Orbstack using these instructions.

Environment

For both Linux and Mac you need to set VITE_APP_ORIGIN to a url that includes https in the .env file.:

  • VITE_APP_ORIGIN=https://${APP_DOMAIN}

Everything should work out of the box if you've followed the steps above, but you might need to update these environment variables in your .env as well:

  • APP_HTTPS=true
  • APP_DOMAIN=https://${APP_DOMAIN}

thisisdevelopment/laravel-base 适用场景与选型建议

thisisdevelopment/laravel-base 是一款 基于 Blade 开发的 Composer 扩展包,目前已累计 139 次下载、GitHub Stars 达 2, 最近一次更新时间为 2020 年 03 月 09 日, 在 PHP 生态内属于活跃度较高的组件。

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

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

围绕 thisisdevelopment/laravel-base 我们能提供哪些服务?
定制开发 / 二次开发

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

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

GitHub 信息

  • Stars: 2
  • Watchers: 6
  • Forks: 0
  • 开发语言: Blade

其他信息

  • 授权协议: MIT
  • 更新时间: 2020-03-09