PHP code example of vundi / potato-orm

1. Go to this page and download the library: Download vundi/potato-orm library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

vundi / potato-orm example snippets


$users = User::findAll(); // Returns an array of the users found in the db

$user = User::find(2); // will return user with an ID of 2

$user = User::find(2);
$user->name = "Devy Kerr";
$user->company = "Suyabay";
$user->update();

//Will remove a user from the database table
User::remove(2); // 2 represents the id of the user to be removed
 php

// Load the `.env` variables for the project
// Check the `.env.example` file in the root of the project to see the environment variables needed.
$dotenv = new Dotenv\Dotenv(__DIR__);
$dotenv->load();