dex/frontier
Composer 安装命令:
composer require dex/frontier
包简介
The frontier between your Laravel app and your decoupled frontend
README 文档
README
The frontier between your Laravel app and your decoupled frontend.
Frontier allows you to run your favorite frontend framework and to serve the initial page by the backend, like a proxy.
It's great for anyone using custom domains to test their applications or running multiple frontends that use the same backend. You will be able to test your app using cookies, sessions and avoiding CORS "same source" issues.
Installation
Just install dex/frontier into your Laravel app and configure some
environment variables.
composer require dex/frontier
Environment variables
You can configure your frontend using some environment variables described below.
| Variable | Description | Default |
|---|---|---|
FRONTIER_TYPE |
Define type of controller http, proxy or view |
view |
FRONTIER_ENDPOINT |
Endpoint where the frontend will run | frontier |
FRONTIER_VIEW |
Default view that will be rendered or url of the server |
frontier::index |
FRONTIER_VIEWS_PATH |
Directory where all the views are |
frontier/resources/html |
FRONTIER_FIND |
Content that will be replaced | |
FRONTIER_REPLACE_WITH |
Content that will be the replacement | |
FRONTIER_PROXY |
URIs that you will do proxy | |
FRONTIER_CACHE |
When http type, indicates se cache will be do |
true |
FRONTIER_PROXY_HOST |
url of the assets server |
|
FRONTIER_PROXY_RULES |
Proxy rules |
Frontend types
You can use 3 different types of frontend http, proxy or view.
HTTP
Use in FRONTIER_VIEW the URL of your frontend server.
Proxy
Use in FRONTIER_PROXY_HOST or FRONTIER_VIEW the URL of your frontend server.
FRONTIER_VIEWwill be removed in the future.
View
Use in FRONTIER_VIEW the name of your view that you initialize your frontend, this is relative a Blade views.
Examples
Vite and Vue.js
When using Vite and Vue.js you can start your project with these
environment variables using http approach.
FRONTIER_ENDPOINT=/vue FRONTIER_TYPE=http FRONTIER_VIEW=http://localhost:5173/ FRONTIER_FIND=/@vite/client,/src/main.ts,/vite.svg FRONTIER_REPLACE_WITH=http://localhost:5173/@vite/client,http://localhost:5173/src/main.ts,http://localhost:5173/vite.svg FRONTIER_PROXY=/vite.svg FRONTIER_CACHE=false
Nuxt.js
When using Nuxt you can start your project with these environment variables using proxy approach.
FRONTIER_PROXY_HOST=http://localhost:3000 FRONTIER_PROXY_RULES=/_vfs.json::exact|/favicon.ico::exact::rewrite(/favicon.ico)|/__nuxt_devtools__/client/_nuxt/builds/meta|/__nuxt_devtools__/client::replace(/__nuxt_devtools__/client/_nuxt/)|/_nuxt|/_fonts|/::replace(/_nuxt/)
Multiple frontends
You can run multiple frontends, just create a custom configuration file.
php artisan vendor:publish --tag=frontier
The config/frontier.php file will be created in your Laravel app. This file contains some settings that can be
replicated to add more frontends to your app.
License
Frontier is licensed under the MIT license. See the license file for more details.
dex/frontier 适用场景与选型建议
dex/frontier 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 32.18k 次下载、GitHub Stars 达 3, 最近一次更新时间为 2022 年 01 月 11 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 dex/frontier 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 dex/frontier 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 32.18k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 3
- 点击次数: 13
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2022-01-11