survos/core-bundle
Composer 安装命令:
composer require survos/core-bundle
包简介
Traits and Interfaces common to other Survos bundles
README 文档
README
Symfony Bundle with interfaces, traits, models and services needed by more than one Survos components. For example, Model\Column is used by grid, api-grid and simple-datatables. RouteParametersInterface is used by tree and the griid bundles.
composer req survos/core-bundle
<?php // src/Entity/Foo.php namespace App\Entity; use Survos\CoreBundle\Entity\RouteParametersInterface; use Survos\CoreBundle\Entity\RouteParametersTrait; class Foo implements RouteParametersInterface { use RouteParametersTrait; public function getUniqueParams(): array { return ['fooId' => $this->getFooCode()]; }
Now use .rp in twig and ->getRp() in php as part of generating a route
<a href="{{ path('foo_show', foo.rp) }}">Show</a>
Combined with survos/maker-bundle, create a param converter
bin/console survos:make:param-converter Foo
Helper Tasks
echo "SYMFONY_DEPRECATIONS_HELPER=weak" >> .env
Shared Utilities
Survos\CoreBundle\Service\SurvosUtils is the home for small, shared helpers
that are useful across multiple Survos bundles and applications. Before adding
local string/path/entity helper methods in another bundle, check here first.
Common static helpers:
| Helper | Purpose |
|---|---|
SurvosUtils::slugify($code, separator: '_') |
Stable ASCII slugs for route codes, index names, file-safe identifiers, and bundle metadata. |
SurvosUtils::entityCode($class) |
Stable admin/browser code for entity classes. App\Entity\Intake becomes app_intake; Survos\OutreachBundle\Entity\Contact becomes outreach_contact. Used by api-grid and Tabler admin menus. |
SurvosUtils::formatLargeNumber($number) |
Compact counts for badges and summaries, e.g. 1.2k or 3.4m. |
SurvosUtils::humanFilesize($size) |
Human readable byte sizes. |
SurvosUtils::parseQueryString($data) |
Query-string parsing that preserves parameter names Symfony/PHP would otherwise normalize. |
SurvosUtils::actualClass($objectOrClass) |
Resolve Doctrine proxy classes back to their real class name. |
SurvosUtils::createDir($dir) |
Create a directory if missing and return its real path with a trailing slash. |
SurvosUtils::assertKeyExists() / assertInArray() |
Assertions with useful “missing key/value” diagnostics. |
Example:
use App\Entity\Intake; use Survos\CoreBundle\Service\SurvosUtils; $code = SurvosUtils::entityCode(Intake::class); // app_intake $route = $code . '_show'; // app_intake_show
Instance helpers are available when the service is injected:
| Helper | Purpose |
|---|---|
$utils->cleanPath($filename) |
Shorten paths relative to kernel.project_dir for logs/debug output. |
$utils->flatten($messages) |
Flatten nested message/config arrays into dot paths. |
$utils->populateObjectFromData($object, $data) |
Populate an object using Symfony PropertyAccess. |
Guideline for agents and bundle authors: if a helper needs to be shared by
api-grid-bundle, tabler-bundle, field-bundle, maker code, or app code, put
it in core-bundle instead of recreating it locally.
survos/core-bundle 适用场景与选型建议
survos/core-bundle 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 16.52k 次下载、GitHub Stars 达 2, 最近一次更新时间为 2022 年 06 月 11 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「symfony entity routing」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 survos/core-bundle 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 survos/core-bundle 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 survos/core-bundle 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Runn Me! Value Objects Library
The bundle for easy using json-rpc api on your project
Write down your routing mapping at one place
generates php entities from openapi spec
Flight routing is a simple, fast PHP router that is easy to get integrated with other routers.
DCSDynamicDiscriminatorMapBundle simplifies the use of Doctrine Single Table Inheritance mapping strategy in Symfony2.
统计信息
- 总下载量: 16.52k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 12
- 依赖项目数: 12
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2022-06-11