Download the PHP package jimchen/yii2-facades without Composer

On this page you can find all versions of the php package jimchen/yii2-facades. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package yii2-facades

Facades for Yii 2

Laravel like facades support for Yii 2 application components. Just what you want: simple, extensive and with an IDE auto completion support via PHPDoc so you won't be disappointed.

Packagist Version Total Downloads

Table of contents

Installation

The preferred way to install this extension is through composer.

Either run

Usage

Basically you install the extension and start using it like you do with all normal Yii 2 application components but with a shorter simpler syntax, let's take a look (in case you wonder, all default facades, including an abstract base Facade reside under a jimchen\facades namespace):

Generate random string

Before:

After:

Fetch all users (just an example!)

Before:

After:

Format currency

Before:

After:

Access properties

Any class public property $foo can be got via an accessor:

And set:

Available facades

Name Facaded component alias Component/interface
Asset Yii::$app->assetManager yii\web\AssetManager
Auth Yii::$app->auth yii\rbac\ManagerInterface
Cache Yii::$app->cache yii\caching\Cache
Db Yii::$app->db yii\db\Connection
Error Yii::$app->errorHandler yii\console\ErrorHandler
yii\web\ErrorHandler
Formatter Yii::$app->formatter yii\i18n\Formatter
I18n Yii::$app->i18n yii\i18n\I18N
Log Yii::$app->log yii\log\Dispatcher
Mailer Yii::$app->mailer yii\swiftmailer\Mailer
Redis Yii::$app->redis yii\redis\Connection
Request Yii::$app->request yii\console\Request
yii\web\Request
Response Yii::$app->response yii\console\Response
yii\web\Response
Router Yii::$app->urlManager yii\web\UrlManager
Security Yii::$app->security yii\base\Security
Session Yii::$app->session yii\web\Session
Url Yii::$app->urlManager yii\web\UrlManager
User Yii::$app->user yii\web\User
View Yii::$app->view yii\web\View

Helpers

Some facades also contain useful helpers to make a development more quick and elegant.

Cache

cache

Retrieves a value using the provided key or the specified default value if the value is not cached. If the value is not in the cache, it will be cached. The default value can also be a closure:

get

Retrieves a value using the provided key and returns it or the specified default value which can also be a closure:

Response

bare

Returns an empty response with optional headers:

html

Returns a HTML response with optional headers:

json

Returns a JSON response with optional headers:

jsonp

Returns a JSONP response with optional headers:

raw

Returns a response with data "as is" with optional headers:

xml

Returns a XML response with optional headers:

Extending

If you want a new facade, it's fast and easy, imagine you want to bring a YourFacadeName facade:

Then whenever you call

it will be executed as


All versions of yii2-facades with dependencies

PHP Build Version
Package Version
Requires php Version >=5.4
yiisoft/yii2 Version ~2.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package jimchen/yii2-facades contains the following files

Loading the files please wait ....