-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from mgcostaParedes/readme-1#
fix: updated readme
- Loading branch information
Showing
1 changed file
with
35 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,21 @@ | ||
## Spanner ORM Builder | ||
## Spanner ORM Builder For PHP | ||
|
||
[](//packagist.org/packages/mgcosta/spanner-orm-builder) | ||
[](https://travis-ci.com/mgcostaParedes/spanner-orm-builder) | ||
[](https://codecov.io/gh/mgcostaParedes/spanner-orm-builder) | ||
[](//packagist.org/packages/mgcosta/spanner-orm-builder) | ||
|
||
|
||
The Spanner ORM Builder is a database toolkit to PHP, providing an expressive query builder, ActiveRecord style ORM, it can serve as a database layer for your PHP app if you intend to work with **Google Cloud Spanner**. | ||
|
||
## Install | ||
|
||
Via Composer | ||
|
||
``` bash | ||
$ composer require mgcosta/spanner-orm-builder | ||
``` | ||
|
||
### Usage Instructions | ||
|
||
First, we should create a new "Manager" instance. Manager aims to make configuring the library for every framework as easy as possible. | ||
|
@@ -28,11 +39,33 @@ Once the Manager instance has been registered, we may use it like: | |
**Using The Query Builder** | ||
|
||
```PHP | ||
use MgCosta\Spanner\Model\Model; | ||
|
||
class User extends \MgCosta\Spanner\Model\Model {} | ||
class User extends Model {} | ||
|
||
$users = User::where('age', '>', 30)->get(); | ||
|
||
``` | ||
|
||
**Saving a model ** | ||
|
||
```PHP | ||
use MgCosta\Spanner\Model\Model; | ||
|
||
class User extends Model { | ||
protected $primaryKey = 'UserId'; | ||
|
||
public $name; | ||
public $age; | ||
public $email; | ||
} | ||
|
||
$user = new User(); | ||
$user->name = 'Miguel'; | ||
$user->age = 28; | ||
$user->email = '[email protected]'; | ||
$user->save(); | ||
|
||
``` | ||
|
||
The implementation of the query builder is inspired on Laravel Query Builder, to get more documentation follow the [link](https://laravel.com/docs/master/queries). |