Download the PHP package simialbi/yii2-rest-client without Composer

On this page you can find all versions of the php package simialbi/yii2-rest-client. 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-rest-client

REST Client for Yii 2 (ActiveRecord-like model)

This extension provides an interface to work with RESTful API via ActiveRecord-like model in Yii 2. It is based on ApexWire's yii2-restclient.

Latest Stable Version Total Downloads License Build Status

Resources

Installation

The preferred way to install this extension is through composer.

Either run

or add

to the require section of your composer.json.

Configuration

To use this extension, configure restclient component in your application config:

Parameter Default Description
baseUrl '' The location of the api. E.g. for http://api.site.com/v1/users the baseUrl would be http://api.site.com/v1/ (required)
auth Either a Closure which returns a string or a string. The rest connection will be passed as parameter.
usePluralisation true Whether to use plural version for lists (index action) or not (e.g. http://api.site.com/users instead of user)
useFilterKeyword true Whether to use "filter" key word in url parameters when filtering (e.g. ?filter[name]=user instead of ?name=user
enableExceptions false Whether the connection should throw an exception if response is not 200 or not
itemsProperty If your items are wrapped inside a property (e.g. items), set it's name here
requestConfig [] Client request configuration
responseConfig [] Client response configuration
updateMethod 'put' The method to use for update operations.
isTestMode false Whether we are in test mode or not (prevent execution)
enableQueryCache false Whether to enable query caching
queryCacheDuration 3600 The default number of seconds that query results can remain valid in cache
queryCache 'cache' The cache object or the ID of the cache application component

Usage

Define your Model

It's important that you define the primary key by overriding primaryKey() method. Otherwise you'll get an exception. If you do not override the modelName() method, it will guess it by class name (MyModel becomes my-model). It's used to generate the URL together with simialbi\yii2\rest\Connection::$baseUrl.

The usage how to define the active record (rules, behaviors etc.) is the same like yii\db\ActiveRecord.

Important: Be sure to either define the properties of the object like in the example above (@property syntax in phpdoc) or override the attributes() method to return the allowed attributes as array

The same about relations. Be sure to either define them via @property-read phpdoc comment or override the getRelations method. If the related class has not the same namespace as the main class, be sure to use the fully qualified class name (e.g. @property-read \app\models\OtherModel[] $otherModels)

License

yii2-rest-client is released under MIT license. See bundled LICENSE for details.

Acknowledgments


All versions of yii2-rest-client with dependencies

PHP Build Version
Package Version
Requires php Version >=7.3
yiisoft/yii2 Version ^2.0.14
yiisoft/yii2-httpclient Version ^2.0.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 simialbi/yii2-rest-client contains the following files

Loading the files please wait ....