承接 roketin/connect 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

roketin/connect

Composer 安装命令:

composer require roketin/connect

包简介

Roketin Engine API Client

README 文档

README

Latest Version License Total Downloads

RClient is standard client application to Roketin API to accelerate connecting and integrating basic feature of Roketin Engine API to client's website.

API Documentation

Documentation for the Roketin API can be found on the Documentation.

Installation

Laravel 5

"require": {
    "laravel/framework": "5.0.*",
    "roketin/connect": "v0.0.9"
}

Next, run the Composer update command from the Terminal:

composer update

or

composer update "roketin/connect"

CONFIGURATION

  1. Open config/app.php and addd this line to your Service Providers Array
  Roketin\Providers\RoketinServiceProvider::class,
  1. Open config/app.php and addd this line to your Aliases
    'Roketin' => Roketin\Facades\RoketinFacade::class
  1. Publish the config using the following command:

    $ php artisan vendor:publish --provider="Roketin\Providers\RoketinServiceProvider"

  2. Create an .env file based on .env.example file and change the value based on client credentials

  ROKETIN_API=http://dev.roketin.com/api/v2.2/
  ROKETIN_PUBLIC=http://dev.roketin.com/

  ROKETIN_TOKEN=aBCd1234
  ROKETIN_USERNAME=roketin
  ROKETIN_RX=4241639264053293060625251241576152575759

HOW TO USE

Basic

You can call a Roketin Object by using: Roketin::model()->get()

    use Roketin;
    
    $menus = Roketin::menus()->get();
    $posts = Roketin::posts()->get();
    $products = Roketin::products()->get();
    $variants = Roketin::variants()->get();
    etc..

Fethcing single object with id/slug/etc:

    /*
     * Same as fetching object, but in singular form (without 's')
     * the second argument can be id or slug or etc ..
     * this is dynamic function call to Roketin Engine API
     */
    
    $home = Roketin::menu('home')->get();
    $post = Roketin::post('latest-update')->get();

Conditions

Fetching object with simple where conditions:

    /**
     * @param $field
     * @param $operation
     * @param $value
     */

    $posts = Roketin::posts()->where('title','like','vacation')->get();
    
    //NOTE : 
    //It doesn't need to add % if using 'like' operator

Fetching object with simple orWhere conditions:

    /**
     * @param $field
     * @param $operation
     * @param $value
     */

    $posts = Roketin::posts()
                        ->where('title','like','vacation')
                        ->orWhere('title','like','holiday')
                        ->get();
    
    //NOTE : 
    //It doesn't need to add % if using 'like' operator

Advance where orWhere grouping conditions:

    /**
     * @param $field
     * @param $operation
     * @param $value
     */

    $posts = Roketin::posts()
                        ->where('title','like','vacation')
                        ->orWhere('title','like','holiday')
                        ->where('date','>=','2016-04-10')
                        ->where('date','<=','2016-04-18')
                        ->get();
    
    //NOTE : 
    //It will result query grouping 
    // (title like vacation or title like holiday) 
    // AND 
    // (date >= 2016-04-10 and date <= 2016-04-18 )

Sorting

Fetch a Roketin Object API by sorting on it's field:

    /*
     * sorting object before fetch
     * 
     * @param $field
     * @param $direction (optional) default is ASC
     * /

    $posts = Roketin::posts()->sortBy('created_at')->get();
    $posts = Roketin::posts()->sortBy('created_at','DESC')->get();

Grouping

Fetch a Roketin Object API by grouping on it's field:

    /*
     * grouping object before fetch
     * 
     * @param $field
     * /

    $posts = Roketin::posts()->groupBy('created_at')->get();
    $posts = Roketin::posts()->groupBy('id')->groupBy('created_at')->get();

Pagination

Paginating fetch object

    /*
     * paginate object before fetch
     * 
     * @param $size default value is 10
     * @param $page (optional)
     * /

    $posts = Roketin::posts()->paginate(10)->get();
    $posts = Roketin::posts()->paginate(10,2)->get();

Tags

Get all tags post:

    $tags = Roketin::tags()->get()

Get all posts by tag:

    /*
     * @param $tag separated by ';'
     * @param $is_blog (optional) default value is false
     */
    $posts = Roketin::tags('tag_1;tag_2',false)->get()

Archives

Get archives by year:

    /*
     * @param $tags (optional) default value is '', multiple (; as separator)
     * @param $year (optional) default value is '2016'
     */
    $archive = Roketin::archives('tags;tags2;another tag','2016')->get()

Shipping

Get all available countries:

    $countries = Roketin::shipping()->countries()

Get all available provinces (currently available in Indonesia only):

    $province = Roketin::shipping()->province()

Get all available city (currently available in Indonesia only):

    /*
     * @param $provinceid
     */

    $cities = Roketin::shipping()->province(9)->cities()

Calculate shipping costs:

    /*
     * @param $destination = city id
     * @param $courier = JNE/TIKI/POS
     * @param $weight = item weight in KG (optional) default value 1
     * @param $origin = city id
     */

    $costs = Roketin::shipping()->costs(23, 'JNE')

Order

Create sales order:

    /*
     * @param array $generalData
     * @param array $customerData
     * @param array $products
     * @param $bcc(optional), default = null
     */
     
     $generalData = [
            "notes"         => "some string here",
            "is_email_only" => true, //default value false (for customer guest)
            "ship_cost"     => 10000,
            'ship_provider' => "JNE"
     ];

     $customerData = [
            "first_name" => "Roketin",
            "last_name"  => "User",
            "phone"      => "+628123456789",
            "email"      => "user@roketin.com",
     ];

     $products = [
         [
             "id"         => "2623",
             "qty"        => "1",
             "sku"        => "ADVHEL001",
             "price_type" => "retail_price",
         ],
     ];                                 
    $order = Roketin::order()->create($generalData, $customerData, $products, 'test@mailinator.com')

Note:

  • For detailed attribute, see sales order API documentation HERE

Confirm payment order:

    /*
     * @param $invoice_number
     * @param $payment_type
     * @param $total
     * @param $customer_name
     * @param $customer_bank
     * @param $transaction_number
     * @param Image $image
     * @param $bank_account(optional), default = null
     * @param $paid_date(optional), default = null
     * @param $bcc(optional), default = null
     */
     
    //you can create image for bank transfer that 
    //showing transfer is success
    //by using Image::make()
    $img = Image::make(Input::file('image'))
    
    $payment = Roketin::order()
                ->confirm('SI16041300058', 
                          'TRANSFER', 
                          '150000', 
                          'Customer Roketin', 
                          'Bank BCA', 
                          'TRX-123', 
                          $img, 
                          '0853909090',
                          '2016-04-10',
                          'bcc@mailinator.com')

Void an Sales Order and it's invoice:

    /*
     * @param $invoice_number
     */

    $order = Roketin::order()->void('ASD02262016')

Subscribe

Submit a subscription email:

    /*
     * @param $email
     * @param $bcc(optional), default = null
     */

    $subscribe = Roketin::subscribe('somebody@anythin.com', 'bcc@mailinator.com')

Message

Send a message to Roketin Engine Inbox:

    /*
     * @param $sender_name
     * @param $sender_email
     * @param $sender_phone
     * @param $message_title
     * @param $message_body
     * @param $bcc(optional), default = null
     */

    $msg = Roketin::message()
                    ->send(
                    'test',
                    'test@mailinator.com',
                    '123123',
                    'test mesage',
                    'hai',
                    'bcc@mailinator.com')

Message

Send a message to Roketin Engine Inbox:

    /*
     * @param $sender_name
     * @param $sender_email
     * @param $sender_phone
     * @param $message_title
     * @param $message_body
     * @param $bcc(optional), default = null
     */

    $msg = Roketin::message()
                    ->send(
                    'test',
                    'test@mailinator.com',
                    '123123',
                    'test mesage',
                    'hai',
                    'bcc@mailinator.com')

Vouchers

Check validity of a voucher:

    /*
     * @param $code
     * @param $voucher_type (optional), default = null
     * voucher type can be giftvoucher (voucher in 
     * exchange to money nominal) or
     * other (voucher to exchange to free product)
     * default is voucher_type is other
     */

    $check = Roketin::voucher()->check('AS123D')

invalidate a voucher (use voucher):

    /*
     * @param $voucher_code
     * @param $voucher_type (optional) default is other
     * @param $used_by (optional) default is logged in user
     */

    $check = Roketin::voucher()->invalidate('AS123D')

Users

Register new user:

    /*
     * @param $first_name
     * @param $last_name
     * @param $email
     * @param $phone
     * @param $password
     * @param $password_confirmation
     * @param $bcc(optional), default = null
     * @return user object
     */

    $user = Roketin::user()->register('first_name', 'last_name', 'email', 'phone', 'password', 'password_confirmation', 'bcc');

User activation:

    /*
     * @param $token
     * @return true if success activation
     * @return error object if present
     */

    $activation = Roketin::user()->activate('token');

Resend activation code to email:

    /*
     * @param $email
     * @return true if success activation
     * @return error object if present
     */

    $resend = Roketin::user()->resendActivation('someone@somthing.com');

Forgot password (generate and send token to user email):

    /*
     * @param $email
     * @param $bcc(optional), default = null
     * @return true if success activation
     * @return error object if present
     */

    Roketin::user()->forgot('someone@somthing.com', 'bcc@mailinator.com');

Reset password:

    /*
     * @param $token
     * @param $password
     * @param $password_confirmation
     * @param $bcc(optional), default = null
     * @return true if success activation
     * @return error object if present
     */

    Roketin::user()->resetPassword('token','asdf','asdf', 'bcc@mailinator.com');

Login:

    /*
     * @param $email
     * @param $password
     * @param $type (optional) default = user, available = vendor
     * @return true if success activation
     * @return error object if present
     */

    Roketin::auth()->login('somebody@somthing.com','asdf');

Current User:

    /*
     * @return user object
     */

    Roketin::auth()->user();

Update user data:

    /*
     * @return user object
     */

    Roketin::user()->update(['first_name' => 'John']);

Note:

  • For detailed attribute, see sales order API documentation HERE

Get transaction history data:

    /*
     * @return user object
     */

    Roketin::user()->transactionHistory()->get();

Note:

  • you can also use where(), orWhere(), etc query with this method

Logout:

    /*
     * @return boolean
     */

    Roketin::auth()->logout();

Others

Get Product Variants By Category:

    /*
     * @param $category_name
     * @return variants object
     */

    Roketin::variantsByCategory($category_name)->get();

roketin/connect 适用场景与选型建议

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

它主要适用于以下技术方向: 「rest」 「api」 「client」 「engine」 「laravel」 「apiclient」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

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

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

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

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

GitHub 信息

  • Stars: 0
  • Watchers: 4
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2016-04-28