for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace roaresearch\yii2\roa\urlRules;
/**
* Rule for routing response streams to access a file for download or view it
* on browser.
*
* @author Angel (Faryshta) Guevara <[email protected]>
*/
class File extends Resource
{
* @inheritdoc
public $patterns = [
'PUT,PATCH,POST {id}' => 'update',
'DELETE {id}' => 'delete',
'GET,HEAD {id}' => 'view',
'POST' => 'create',
'GET,HEAD' => 'index',
'{id}' => 'options',
'GET {id}.{ext}' => 'file-stream',
'' => 'options',
];
* @var string[] list of valid extensions that this rule can handle.
public array $ext = ['png', 'jpg'];
public function init()
$this->tokens['{ext}'] = '<ext:(' . implode('|', $this->ext) . ')>';
parent::init();
}