Download the PHP package genesis/persistence without Composer

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

Genesis Persistence Codeship Status for forceedge01/genesis-persistence

Introduction

This package allows for super fast model implementation that can port over the database model straight into your database manager.

Usage

To use the mapperService, please create a model (you can call it whatever you want) that extends the BaseModel. Your model does not need to implement any getters and setters, these will be provided out of the box by the BaseModel. You will have to declare all your model properties as protected.

Creating a model

In the above example your model defines how the database is setup and will be communicated with. Each property will define what type and constraints it should have. Please note that the id property is inherited by the BaseModel and will be included in all tables as a must.

Using a model with the mapper

The mapper provides a simple yet powerful layer of abstraction for you. It understands how your model needs to be saved and retrieved from the database.

Instantiation

The library only supports a few databases at the moment and is only tested so far with sqlite. Please use the config below to connect with appropriate drivers.

For clarity and to avoid confusion, please define all of the above config for your project. For any info on what they mean please visit the relevant PHP manual pages for the PDO construct.

Saving and retrieving data.

The mapper exposes the databaseService which allows you to perform more complex queries while still binding objects back to the original models. Consider the following example

Retrieving an associated model object

Have you noticed that the MyItemModel has a userId property, this property would, in an ideal world link to another record in the database in the User table. If you have modeled this User in your app, you can use the getAssociated call provided by the mapper to get this record out. Consider the example below.

Deleting records

The mapper allows you to delete records in two ways. Consider the examples below.

Feel free to explore other calls provided by the mapperService. The mapper also allows you to create tables based on a model.

Console

This packages comes with 2 console scripts

  1. db-setup.php {model-directory} # Setup your database based on your model class definitions.
  2. db-migrate.php {model-directory} # Any changes you've made to the model class definitions will be detected.

Find these in the bin folder.


All versions of persistence with dependencies

PHP Build Version
Package Version
Requires php Version ~5.4||~7.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 genesis/persistence contains the following files

Loading the files please wait ....