PHPackages                             kolyunya/yii2-partial-content - 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. kolyunya/yii2-partial-content

ActiveYii2-extension[Framework](/categories/framework)

kolyunya/yii2-partial-content
=============================

Yii2 partial content filter.

156PHP

Since Nov 14Pushed 11y ago2 watchersCompare

[ Source](https://github.com/Kolyunya/yii2-partial-content)[ Packagist](https://packagist.org/packages/kolyunya/yii2-partial-content)[ RSS](/packages/kolyunya-yii2-partial-content/feed)WikiDiscussions master Synced 3d ago

READMEChangelogDependenciesVersions (1)Used By (0)

\#Yii2 partial content filter

\##Description

A [Yii2 filter](http://www.yiiframework.com/doc-2.0/yii-base-actionfilter.html) which empowers a controller with a functionality of a [partial HTTP response](https://ru.wikipedia.org/wiki/%D0%A1%D0%BF%D0%B8%D1%81%D0%BE%D0%BA_%D0%BA%D0%BE%D0%B4%D0%BE%D0%B2_%D1%81%D0%BE%D1%81%D1%82%D0%BE%D1%8F%D0%BD%D0%B8%D1%8F_HTTP#206).

The widget is [composer](https://getcomposer.org/)-enabled. You can aquire the latest available version from the [packagist repository](https://packagist.org/packages/kolyunya/yii2-partial-content).

\##Usage example

The controller currently has four options to set the content to be sent to the client. Those options are `contentData`, `contentResource`, `contentStream` and the `contentFile`. The use of those properties is pretty straightforward. One of those properties will be used by the filter to send data to the client completly or partially depending on it's request. The filter should be added to the controller just like any other Yii2 action filter. You may also specify actions which should be processed by the filter.

The controller may also set the `contentType` property of the filter which will be used by the filter as a value of the `Content-Type` header. The default value is `application/octet-stream`.

The controller may also set the `contentName` property of the filter which will be used as a filename value of the `Content-Disposition` header. If the controller does not set this property this header will not be sent.

```
public function behaviors()
{

    return
    [

        // Add a partial content filter
        'partial-content' =>
        [

            // Specify filter class name
            'class' => 'kolyunya\yii2\filters\PartialContent',

            // Specify which actions it will be applied to
            'only' =>
            [
                'get'
            ]

        ]

    ];

}

public function actionGet()
{

    // Get a reference to the filter
    $behavior = $this->getBehavior('partial-content');

    // Now you have four options to set the data

    // [0] - Either set the data itself
    $behavior->contentData = $this->data;

    // [1] - Or specify the data resource
    $behavior->contentResource = $this->resource;

    // [2] - Or specify the data stream
    $behavior->contentStream = $this->stream;

    // [3] - Or specify the file name
    $behavior->contentFile = $this->file;

    // Optionally set the content type
    $behavior->contentType = 'audio/mpeg';

    // Optionally set the content name
    $behavior->contentName = 'My new song';

    // The filter will do the rest itself

}
```

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community8

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://avatars.githubusercontent.com/u/2682768?v=4)[Nick Oleynikov](/maintainers/Kolyunya)[@Kolyunya](https://github.com/Kolyunya)

---

Top Contributors

[![Kolyunya](https://avatars.githubusercontent.com/u/2682768?v=4)](https://github.com/Kolyunya "Kolyunya (16 commits)")

### Embed Badge

![Health badge](/badges/kolyunya-yii2-partial-content/health.svg)

```
[![Health](https://phpackages.com/badges/kolyunya-yii2-partial-content/health.svg)](https://phpackages.com/packages/kolyunya-yii2-partial-content)
```

###  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)
