Download the PHP package blainesch/li3_fake_model without Composer

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

Lithium Fake Model

For those times when you don't want a real one

Build Status

This library is for the PHP Lithium Web Framework and provides an alternative to its built-in data models.

It doesn't do much, but that's kinda the point. Here's a comparison:

Lithium Models Fake Models
Dirty Attributes yes no
Filterable (AOP) yes no
Schema Definition yes no
Uses LI3 Data Sources yes yes [1]
Works with SQL and Mongo yes maybe [2]
Model-level Relationships no yes

[1] Sort of. We wrap the native LI3 data source in our own to avoid the Document/DocumentSet madness.

[2] I've only tested with MongoDB, but Fake Models could be adjusted to work with a SQL data source if someone wants to make the effort.

Then why would I use this?

You probably shouldn't. I mean, Fake Models do basically nothing! No one in their right mind would make the switch.

OK, to be honest, Lithium Models are bloated and they're slow. They store lots of redundant data, and all the filterable methods (I suspect) contribute to their slowness.

Here are some benchmarks...

Count Lithium Models Fake Models
first() 1 76ms 32ms
all() 100 2863ms 78ms

Each test was with 100 iterations (divide each by 100 to get true timing).

Relationships

Lithium models support relationships at the data source layer, which works fine for relational databases, but not for MongoDB.

Fake models support relationships at the model level and efficiently eager-loads related records by issuing extra queries. Here's how you use it:

1. Define your model relationships.

2. Query your model and tell it which relationships to fetch.

The above query will:

  1. query and fetch all the posts
  2. issue a second query to get all the comments
  3. connect the child comments onto the appropriate parent posts

Relationships can also provide deep query logic:

Relationships can also be nested further, e.g.:

This method call still only issues 3 total queries to the Mongo database, yipee!

Copyright and License

Fake model is licensed under the MIT License - see the LICENSE file for details


All versions of li3_fake_model with dependencies

PHP Build Version
Package Version
Requires php Version >=5.3
composer/installers Version *
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 blainesch/li3_fake_model contains the following files

Loading the files please wait ....