PHPackages                             drmabuse/yii2-sir-trevor-js - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. drmabuse/yii2-sir-trevor-js

ActiveYii2-extension[Utility &amp; Helpers](/categories/utility)

drmabuse/yii2-sir-trevor-js
===========================

Yii 2 Sir Trevor JS widget

0.0.5(11y ago)155.5k9BSD-3-ClauseJavaScript

Since Jul 24Pushed 11y ago5 watchersCompare

[ Source](https://github.com/brewing/yii2-sir-trevor-js)[ Packagist](https://packagist.org/packages/drmabuse/yii2-sir-trevor-js)[ Docs](https://github.com/DrMabuse23/yii2-sir-trevor-js)[ RSS](/packages/drmabuse-yii2-sir-trevor-js/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependencies (1)Versions (5)Used By (0)

yii2-sir-trevor-js
==================

[](#yii2-sir-trevor-js)

[![Latest Stable Version](https://camo.githubusercontent.com/fe0b234107c2b63a4f596456be7d9b555b469529ab04f0abf4c4ba14427fb40f/68747470733a2f2f706f7365722e707567782e6f72672f64726d61627573652f796969322d7369722d747265766f722d6a732f762f737461626c652e737667)](https://packagist.org/packages/drmabuse/yii2-sir-trevor-js) [![Total Downloads](https://camo.githubusercontent.com/427d84cef646243f5b4dfc81f0619372b019605b6b693382b3181f02834f058e/68747470733a2f2f706f7365722e707567782e6f72672f64726d61627573652f796969322d7369722d747265766f722d6a732f646f776e6c6f6164732e737667)](https://packagist.org/packages/drmabuse/yii2-sir-trevor-js) [![Latest Unstable Version](https://camo.githubusercontent.com/4ee8efbc9ee67842396f780880b280f8d7702f26dbf8a57efb919cd654817340/68747470733a2f2f706f7365722e707567782e6f72672f64726d61627573652f796969322d7369722d747265766f722d6a732f762f756e737461626c652e737667)](https://packagist.org/packages/drmabuse/yii2-sir-trevor-js) [![License](https://camo.githubusercontent.com/3bc1635203cfc111efa95977ac379c42f4890204cee5171237637165f2510c48/68747470733a2f2f706f7365722e707567782e6f72672f64726d61627573652f796969322d7369722d747265766f722d6a732f6c6963656e73652e737667)](https://packagist.org/packages/drmabuse/yii2-sir-trevor-js)

#### Version 0.0.5

[](#version-005)

a sir-trevor-js module

[![Sir Trevor in action](https://camo.githubusercontent.com/c6fe6380779e1ac184ad0c4025d3df8ac99e268ef6e0ffa3bb43874133db80ef/68747470733a2f2f7261772e6769746875622e636f6d2f6d61646562796d616e792f7369722d747265766f722d6a732f6d61737465722f6578616d706c65732f7369722d747265766f722e676966)](https://camo.githubusercontent.com/c6fe6380779e1ac184ad0c4025d3df8ac99e268ef6e0ffa3bb43874133db80ef/68747470733a2f2f7261772e6769746875622e636f6d2f6d61646562796d616e792f7369722d747265766f722d6a732f6d61737465722f6578616d706c65732f7369722d747265766f722e676966)

Browser support
---------------

[](#browser-support)

Sir Trevor is only tested on the following modern browsers:

- IE10+
- Chrome 25+
- Safari 5+
- Firefox 16+

Dependencies
------------

[](#dependencies)

Sir Trevor requires [Underscore](http://underscorejs.org/) (or LoDash), [jQuery](http://jquery.com) (or Zepto) and [Eventable](https://github.com/madebymany/eventable).

Contributing
------------

[](#contributing)

See the [roadmap](https://github.com/madebymany/sir-trevor-js/wiki/Roadmap) and read a little about [the philosophy](https://github.com/madebymany/sir-trevor-js/wiki/Philosophy) guiding development.

#### Todo

[](#todo)

```
1. create output from Input

```

Get Started
-----------

[](#get-started)

Installation using composer:

```
composer install drmabuse/yii2-sir-trevor-js:"*"

```

Basic Usage
-----------

[](#basic-usage)

```

//Output

```

Advanced Usage
--------------

[](#advanced-usage)

### Image Block - Example File Upload Handler

[](#image-block---example-file-upload-handler)

```
/**
     * Action for file uploads via sir-trevor image block from SirTrevorWidget (input widget)
     *
     * @param $root relative base folder
     */
    public function actionSirTrevorUpload($root)
    {
        $upload         = UploadedFile::getInstanceByName('attachment[file]');
        $model          = new File();
        $name_id        = Inflector::slug(str_replace($upload->extension, '', $upload->name));
        $model->path    = 'images/' . $root . '/' . $model->name_id . '.' . $upload->extension;
        $savePath       = \Yii::getAlias('@backend/web') . '/' . $model->path;

        $response = new Response();
        $response->format = Response::FORMAT_JSON;
        $response->data['message'] = "File";

        if (!is_file($savePath) && is_dir(dirname($savePath))) {
            if ($upload->saveAs($model->path)) {
                $model->mime_type = FileHelper::getMimeType($model->path);
                $model->file_size = $upload->size;
                if ($model->save()) {
                    $items = $this->getItems($this->rootPath);
                    list($width, $height, $type, $attr) = getimagesize($model->path);
                    $response->setStatusCode(200);
                    $response->content = Json::encode(['file' => ['url' => $model->path]]);
                    \Yii::$app->end(0, $response);
                } else {
                    $response->statusText = "Database record could not be saved.";
                }
            } else {
                $response->statusText = "File could not be saved.";
            }
        }else{
            $response->statusText = "File exists or root folder '{$savePath}' not found.";
        }

        $response->setStatusCode(500);
        \Yii::$app->end(0, $response);

    }

```

### Developer Info

[](#developer-info)

If you want to compile/build from the latest javascript sources, use the following commands to get the JavaScript dependencies.

```
npm update
bower update

```

To create the asset files run

```
grunt default

```

To create a new version

```
grunt bumpup
grunt semantic

```

###  Health Score

32

—

LowBetter than 72% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity28

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity56

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.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

4310d ago

### Community

Maintainers

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

---

Top Contributors

[![schmunk42](https://avatars.githubusercontent.com/u/649031?v=4)](https://github.com/schmunk42 "schmunk42 (13 commits)")

---

Tags

yii2sir trevor js

### Embed Badge

![Health badge](/badges/drmabuse-yii2-sir-trevor-js/health.svg)

```
[![Health](https://phpackages.com/badges/drmabuse-yii2-sir-trevor-js/health.svg)](https://phpackages.com/packages/drmabuse-yii2-sir-trevor-js)
```

###  Alternatives

[dmstr/yii2-cookie-consent

Yii2 Cookie Consent Widget

1452.6k](/packages/dmstr-yii2-cookie-consent)[richardfan1126/yii2-js-register

Yii2 widget to register JS into view

1357.2k7](/packages/richardfan1126-yii2-js-register)

PHPackages © 2026

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