Download the PHP package laztopaz/potato-orm without Composer

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

Potato ORM

Coverage Status Scrutinizer Code Quality Build Status

Potato-ORM is a simple agnostic ORM (Object Relational Mapping) package that can perform basic CRUD (Create, Read, Update and Delete) operations.

How to use this package

Composer installation is required before using this package. To install a composer, try running this command on your terminal.

$ curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin

Installation

PHP 5.5+ and Composer are required.

Via composer

$ composer require laztopaz/potato-orm

Install

$ composer install 

After you have installed the package via composer, then you are set to go. Next line of action is to create a class that extends a base Model class under the nameapace Laztopaz/potatoORM. For instance, a class for users or Users table should look like this:

<?php

use Laztopaz\potatoORM;

class User extends BaseModel {

}

You also need set your environment variables to define your database parameters.

databaseName      = xxxxxxx
databaseDriver    = mysql
databaseUsername  = xxxxxxx
databasePassword  = xxxxxxx
databasePort      = 33060
databaseHost      = 127.0.0.1:33060

The default database driver used for this package is mysql. If you wish to change to a new database, define the database parameters in the environment variable file.

Support for database drivers

This package supports the following drivers;

1. MySQL 
2. Postgres 
3. SQLite

To save a new record, you will need to instatiate the class that extends the base model class. Assume your model class is User.

Save a new record

<?php

$user          = new User();
$user->name    = "Temitope Olotin";
$user->gender  = "Male";
$user->alias   = "Laztopaz";
$user->class   = "14";
$user->stack   = "php/laravel";
$user->save();

Read all records from the users table

<?php

$users = User::getAll();

print_r($users);

Update an existing record

<?php

$user         = User::find(1);
$user->name   = "Olotin Temitope";
$user->stack  = "Java/Android";
$user->alias  = "Laztopaz";
$user->save();

Delete a record

<?php 

User::destroy(1);

To make this package degrade gracefully, you will need to wrap it around try and catch so that all exceptions are caught. For instance, to catch exception on save new record try this.

 <?php

    try {
        $user         = new User();
        $user->name   = "Temitope Olotin";
        $user->gender = "Male";
        $user->alias  = "Laztopaz";
        $user->class  = "14";
        $user->stack  = "php/laravel";
        $user->save();

    } catch (Exception $e) {
        echo $e->getMessage();
    }

Read all records from the users table

 <?php
     try {
         $users = User::getAll();
         print_r($users);

     } catch (Exception $e) {
         echo $e->getMessage();
     }

Also for find and update method, you can also wrap it around try and catch.

<?php

  try {
      $user         = User::find(1);
      $user->name   = "Olotin Temitope";
      $user->stack  = "Java/Android";
      $user->alias  = "Laztopaz";
      $user->save();

 } catch (Exception $e) {
     echo $e->getMessage();
 }

For deleting a record too, It is expected that you wrapped your code around try and catch also.

<?php

  try {
      User::destroy(1);
  } catch (Exception $e) {
       echo $e->getMessage();
  }

Testing

Run this command on your terminal

$ composer test or phpunit test

Contributing

To contribute and extend the scope of this package, Please check out CONTRIBUTING file for detailed contribution guidelines.

Credit

Potato ORM Package is created and maintained by Temitope Olotin.


All versions of potato-orm with dependencies

PHP Build Version
Package Version
Requires php Version >=5.5.9
vlucas/phpdotenv Version ^2.2
satooshi/php-coveralls Version ^1.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 laztopaz/potato-orm contains the following files

Loading the files please wait ....