sitegeist/base-url
Composer 安装命令:
composer require sitegeist/base-url
包简介
Determinates base URL from site configurations for scripts where no FE or BE context is available like commands or tasks
README 文档
README
In in scripts where no FE or BE context is available and you want to build URLs its a good idea to get the absolute URL from a site configuration. This extension provides a helper class to get there.
Where to use
- commands which are called via cli
- scheduler tasks
Features
- get base URL depending on site configurations
- absolute a relative URL
Getting Started
use the static functions from BaseUrl helper Class
\Sitegeist\BaseUrl\Helper\BaseUrl::get(); // https://example.com/
\Sitegeist\BaseUrl\Helper\BaseUrl::prepend('home.html'); // https://example.com/home.html
use the viewhelpers in your fluid templates e. g. for mails
<baseurl:get /> <!-- https://example.com/ -->
<baseurl:prepend>home.html</baseurl:prepend> <!-- https://example.com/home.html -->
Multiple site configuration setups
if your system has more than one site configuration, you can specify which site configuration should be used by:
-
specify site configuration identifier
BaseUrl::get('mysite'); BaseUrl::prepend('home.html', 'mysite');
<baseurl:get identifier="mysite" /> <baseurl:prepend identifier="mysite" />home.html</baseurl:prepend>
-
specify a pageUid (anywhere in the pageTree)
BaseUrl::get(null, 1); BaseUrl::prepend('home.html', null, 1);
<baseurl:get pageId="1" /> <baseurl:prepend pageId="1" />home.html</baseurl:prepend>
Getting further
Disable $asString return type to get an TYPO3\CMS\Core\Http\Uri object. Now you can get or change specific parts of the url.
BaseUrl::get(null, null, true, false); BaseUrl::prepend('home.html', null, null, true, false); /* TYPO3\CMS\Core\Http\Uri prototype object scheme => protected "https" (5 chars) supportedSchemes => protected array(2 items) http => 80 (integer) https => 443 (integer) authority => protected "" (0 chars) userInfo => protected "" (0 chars) host => protected "example.com" (11 chars) port => protected NULL path => protected "home.html" (9 chars) query => protected "" (0 chars) fragment => protected NULL */
sitegeist/base-url 适用场景与选型建议
sitegeist/base-url 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 27.65k 次下载、GitHub Stars 达 2, 最近一次更新时间为 2020 年 08 月 24 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「typo3」 「base url」 「typo3-extension」 「absolute url」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 sitegeist/base-url 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 sitegeist/base-url 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 sitegeist/base-url 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
yii2 simialbi base
Encode integer IDs using a preset or customized symbol set
Set Links with a specific language parameter
Easy URL rewrites in your Laravel application
TYPO3 CMS extension to create gallery content element with preset crop ratios and pagination
An interactive tour through the TYPO3 backend.
统计信息
- 总下载量: 27.65k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 13
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: GPL-2.0-or-later
- 更新时间: 2020-08-24