Download the PHP package mikehaertl/defaultpersister without Composer

On this page you can find all versions of the php package mikehaertl/defaultpersister. 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 defaultpersister

DefaultPersister

This is a behavior for CModel (CFormModel, CActiveRecord) which allows to save the set of current attribute values as defaults for the current user and restore them at a later time.

Requirements

Should work with any 1.1.x version. Not tested with 1.0.x.

Usage

When this behavior is attached to a model, the current model values can be saved as default values with a simple command:

This will save all configured attributes in user state (session). To load these defaults back into the model you can use:

It's also possible to save or load only some attributes:

To only load attributes that are safe in the current scenario, you can override the configured value of safeOnly (see below):

Finally to clear the saved default values use:

Configuration

Like all behaviors this extension has to be configured in the behaviors() method of a model:

All attributes that should be saved with saveAsDefaults() must be listed in the attributes property of the behavior.

The complete list of configuration options is:

If loadDefaults() is called before any values where ever saved with saveAsDefaults() the model is scanned for a method attributeDefaults(). If this method is found the returned values (name/value pairs) will be set as default. If no such method is available, loadDefaults() will do nothing in this case.

Since Version 1.1.0 resetDefaults() can be used to clear all attributes, one attribute or a list of attributes default values.

If YII_DEBUG is true, this behavior will trace some messages under the category application.behavior.defaultpersister.

Example

One scenario where this behavior can come in handy is e.g. when a model is used as complex filter model for a datagrid. Think of a backend area with pages for users and projects, each showing a filter form and a datagrid. Changes in the filter form trigger a AJAX grid update. Whenever backend personnel accesses such a page the last filter settings should be restored for convenience.

A controller action for this could look like:

Changelog

1.1.0

1.0.0 - initial release


All versions of defaultpersister with dependencies

PHP Build Version
Package Version
Requires php Version >=5.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 mikehaertl/defaultpersister contains the following files

Loading the files please wait ....