PHPackages                             tink/slim-components - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Framework](/categories/framework)
4. /
5. tink/slim-components

ActiveLibrary[Framework](/categories/framework)

tink/slim-components
====================

A slim framework 3 common components collection

045PHP

Since Nov 24Pushed 8y agoCompare

[ Source](https://github.com/cyub/slim-components)[ Packagist](https://packagist.org/packages/tink/slim-components)[ RSS](/packages/tink-slim-components/feed)WikiDiscussions master Synced 3d ago

READMEChangelogDependenciesVersions (1)Used By (0)

Slim Framework 3 通用组件包
======================

[](#slim-framework-3-通用组件包)

用于[cyub/slim-skeleton](https://github.com/cyub/slim-skeleton)搭建脚手架程序

此通用包一共提供3类组件：服务提供者、门面模式支持、中间件。

服务提供者
-----

[](#服务提供者)

借鉴Laravel的服务提供者，通过`slim-skeleton`里面[settings.php](https://github.com/cyub/slim-skeleton/blob/master/src/settings.php)配置providers选项来启用某一服务，配置示例如下

```
'providers' => [
    ...
    Tink\Common\ServiceProviders\LoggerServiceProvider::class,
    Tink\Common\ServiceProviders\DBServiceProvider::class,
    Tink\Common\ServiceProviders\RedisServiceProvider::class,
    Tink\Common\ServiceProviders\CacheServiceProvider::class,
    Tink\Common\ServiceProviders\ValidatorServiceProvider::class,
    ....
],

```

现支持的服务提供者如下：

**Dotdev**

读取.env文件的配置，依赖[vlucas/phpdotenv](https://github.com/vlucas/phpdotenv)，配合Configure服务来使用

**Configure**

用于读取网站配置，依赖`Tink\Common\Services\Configure`

**Facade**

用于支持门面模式

**Logger**

日志服务提供者，依赖[monolog](https://github.com/Seldaek/monolog)

**DB**

数据库服务提供者，依赖[Illuminate\\Database](https://github.com/illuminate/database)

**Redis**

Redis服务提供者

**Cache**

缓存服务提供者，支持Redis和File缓存类型，依赖[doctrine/cache](https://github.com/doctrine/cache)

**Validator**

验证器服务提供者，依赖[illuminate/validation](https://github.com/illuminate/validation)

**Twig**

Twig模板引擎服务提供者，依赖[slim/twig-view](https://github.com/slimphp/Twig-View)

**PHPView**

PHP原生语言模板引擎提供者，依赖[slim/php-view](https://github.com/slimphp/PHP-View)

门面模式支持
------

[](#门面模式支持)

如果在控制器层或者其他层里面访问注入到IOC容器的组件，需要将容器注入到控制器层，然后通过容器来访问组件。这种方式有时候会比较麻烦，这时候我们可以通过门面模式来动态访问某个组件，而不用关心这个组件具体实现是怎么样

通过配置`slim-skeleton`里面[settings.php](https://github.com/cyub/slim-skeleton/blob/master/src/settings.php)来启动门面，示例配置如下：

```
'alias' => [
    ...
    'Cache'     => Tink\Common\Facades\Cache::class,
    'DB'        => Tink\Common\Facades\DB::class,
    'Config'    => Tink\Common\Facades\Config::class,
    ...
]

```

现支持的门面模式有：

**App**

用于访问当前应用信息

**Cache**

用于缓存操作

**DB**

用于数据库操作

**Log**

用于打日志

**Input**

用于获取请求参数

**Validator**

用于表单验证

**Config**

用于读取配置项

中间件
---

[](#中间件)

现在支持的中间件有:

- [Cors](https://github.com/cyub/slim-components/blob/master/src/Middlewares/Cors.php) 支持跨站资源共享配置

###  Health Score

21

—

LowBetter than 19% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/c7130c37a3972ba7981487e3e1507bc57a7da827ca143c1ed078e8329e22c1cd?d=identicon)[cyub](/maintainers/cyub)

---

Top Contributors

[![cyub](https://avatars.githubusercontent.com/u/26522383?v=4)](https://github.com/cyub "cyub (15 commits)")

### Embed Badge

![Health badge](/badges/tink-slim-components/health.svg)

```
[![Health](https://phpackages.com/badges/tink-slim-components/health.svg)](https://phpackages.com/packages/tink-slim-components)
```

###  Alternatives

[laravel/telescope

An elegant debug assistant for the Laravel framework.

5.2k67.8M192](/packages/laravel-telescope)[spiral/roadrunner

RoadRunner: High-performance PHP application server and process manager written in Go and powered with plugins

8.4k12.2M84](/packages/spiral-roadrunner)[nolimits4web/swiper

Most modern mobile touch slider and framework with hardware accelerated transitions

41.8k177.2k1](/packages/nolimits4web-swiper)[laravel/dusk

Laravel Dusk provides simple end-to-end testing and browser automation.

1.9k36.7M259](/packages/laravel-dusk)[laravel/prompts

Add beautiful and user-friendly forms to your command-line applications.

708181.8M596](/packages/laravel-prompts)[cakephp/chronos

A simple API extension for DateTime.

1.4k47.7M121](/packages/cakephp-chronos)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
