1. Go to this page and download the library: Download softwarepunt/instarecord 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/ */
softwarepunt / instarecord example snippets
class User extends Model
{
public int $id;
public string $email;
public ?string $name;
}
$user = new User();
$user->email = "[email protected]";
$user->save();
echo "Created user #{$user->id}!";
use SoftwarePunt\Instarecord\Model;
class Car extends Model
{
public int $id;
public string $make;
public string $model;
public int $year;
}
$car = new Car();
$car->make = "Toyota";
$car->model = "Corolla";
$car->year = 2005;
$car->save(); // INSERT INTO cars [..]
// Post insert, the primary key (id) is automatically populated
$car->year = 2006;
$car->save(); // UPDATE cars SET year = 2006 WHERE id = 123
$car->delete(); // DELETE FROM cars WHERE id = 123