sgpatil/oriquent 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

sgpatil/oriquent

Composer 安装命令:

composer require sgpatil/oriquent

包简介

Laravel Orientdb Driver

README 文档

README

Oriquent is Orientdb Eloquent Driver for Laravel 5

Version Naming

The version tagging convention which we are following is vX.Y.x.y where

   X => Laravel Major Release
   Y => Laravel Minor Release
   x => Oriquent Major Release
   y => Oriquent Minor Release

So to install oriquent on Laravel 5.4 you will need to install v5.4.*.*

and to install oriquent on Laravel 5.3 you will need to install v5.3.*.*

Note : Branch dev-master will always point to latest release. Currently pointing to Laravel 5.4

You can check complete installation guide in Installation Section.

Quick Reference

Requirements

  • Laravel 5.2
  • Orientdb Server 2.1 or above

Installation

STEP 1 :

Add the package to your composer.json and run composer update.

{
    "require": {
        "sgpatil/oriquent": "dev-master"
    }
}

OR

Run below command in terminal

$ composer require sgpatil/oriquent

STEP 2 :

Add the service provider in config/app.php:

Sgpatil\Orientdb\OrientdbServiceProvider::class,

This will register all the required classes for this package.

Database Configuration

Open config/database.php make orientdb your default connection:

'default' => 'orientdb',

And optionally, if you want to use orientdb as a secondary connection

'default_nosql' => 'orientdb',

Add the connection defaults:

'connections' => [
    'orientdb' => [
        'driver' => 'orientdb',
        'host'   => 'localhost',
        'port'   => '2480',
        'database' => 'database_name',
        'username' => 'root',
        'password' => 'root'
    ]
]

Add your database username and password in 'username' and 'password' field. In 'database_name' add name of orientdb database which you want to connect and use.

Migration

To create a migration, you may use the orient command on the Artisan CLI:

php artisan orient:make create_users_table

The migration will be placed in your database/migrations folder, and will contain a timestamp which allows the framework to determine the order of the migrations.

The --table and --create options may also be used to indicate the name of the table, and whether the migration will be creating a new table:

php artisan orient:make add_votes_to_users_table --table=users_votes

php artisan orient:make create_users_table --create=users

To run migration

php artisan orient:migrate

How to Use

// To insert a record
class User extends \Orientdb {

    protected $fillable = ['name', 'email'];
}

$user = User::create(['name' => 'Some Name', 'email' => 'some@email.com']);

You can use this by extending Orientdb into model class.

To fetch all records

$users = User::all();
foreach($users as $user){
        echo $user->id;
        echo $user->name;
        echo $user->email;
    }

To find a record

$user = User::find(1);

To update a record

$user = User::find(1);
$user->name = "New Name";
$user->save();

Relationships

To create one-to-one relationship

$user =   User::create(['name'=>"Sumit", 'email' => "demo@email.com"]); // Create User node
$phone = new Phone(['code' => 963, 'number' => '98555533']); // Create Phone node
$relation = $user->has_phone()->save($phone); // Creating relationship

Unable to find has_phone() method ? See full example.

Want to learn more? See the wiki.

sgpatil/oriquent 适用场景与选型建议

sgpatil/oriquent 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 387 次下载、GitHub Stars 达 47, 最近一次更新时间为 2016 年 03 月 08 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 sgpatil/oriquent 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 sgpatil/oriquent 我们能提供哪些服务?
定制开发 / 二次开发

基于 sgpatil/oriquent 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 387
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 47
  • 点击次数: 8
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 47
  • Watchers: 6
  • Forks: 14
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2016-03-08