定制 bandwidth-temp/iris 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

bandwidth-temp/iris

Composer 安装命令:

composer require bandwidth-temp/iris

包简介

Bandwidth's Iris SDK for PHP

README 文档

README

Install

Run

composer require bandwidth/iris

Usage

$client = new \Iris\Client($login, $password, ['url' => 'https://api.inetwork.com/v1.0/']);

Run tests

$ composer install
$ php phpunit.phar --bootstrap ./vendor/autoload.php tests/

=======

Examples

There is an 'examples' folder in the source tree that shows how each of the API objects work with simple example code. To run the examples:

$ cd examples
$ composer install
$ cp config.php.example config.php

Edit the config.php to match your IRIS credentials and run the examples individually. e.g.

php availableNumbers-sample.php

If the examples take command line parameters, you will get the usage by just executing the individual script.

API Objects

General principles

In most cases you should use Account object as start point.

$account = new \Iris\Account($your_account_id, $client);

Account has related entities such Orders, Sites, etc.

Example:

$sites = $account->sites();

To get stored Sites you should create $sites object and execute get() method.

$items = $sites->getList(); // Array(Site1, Site2)

To reflect object structure:

echo json_encode($site->to_array());

Available Numbers

$account->availableNumbers([ "areaCode" => "818" ]);

Available NpaNxx

$account->availableNpaNxx(["state" => "CA"]);

Cities

$cities = new \Iris\Cities($client);
$items = $cities->getList(["state" => "NC"]);

Covered Rate Centers

$rcs = new Iris\CoveredRateCenters($client);
$rateCenters = $rcs->getList(["page" => 1, "size" => 10 ]);

Disconnected Numbers

$account->disnumbers(["areaCode" => "919"]);

Disconnect Numbers

The Disconnect object is used to disconnect numbers from an account. Creates a disconnect order that can be tracked

Create Disconnect

$disconnect = $account->disconnects()->create([
    "name" => "test disconnect order 4",
    "CustomerOrderId" => "Disconnect1234",
    "DisconnectTelephoneNumberOrderType" => [
        "TelephoneNumberList" => [
            "TelephoneNumber" => [ "9192755378", "9192755703" ]
        ]
    ]
]]);

Get Disconnect

$disconnect = $account->disconnects()->disconnect("b902dee1-0585-4258-becd-5c7e51ccf5e1", true); // tnDetails: true

Add Note to Disconnect

$disconnect->notes()->create([ "UserId" => "byo_dev", "Description" => "Test Note"]);

Get Notes for Disconnect

$items = $disconnect->notes()->getList();

Dlda

Create Ddla

$order_data = [
    "CustomerOrderId" => "123",
    "DldaTnGroups" => [
        "DldaTnGroup" => [
            [
                "TelephoneNumbers" => [
                    "TelephoneNumber" => "4352154856"
                ],
                "AccountType" => "RESIDENTIAL",
                "ListingType" => "LISTED",
                "ListAddress" => "true",
                "ListingName" => [
                    "FirstName" => "FirstName",
                    "FirstName2" => "FirstName2",
                    "LastName" => "LastName",
                    "Designation" => "Designation",
                    "TitleOfLineage" => "TitleOfLineage",
                    "TitleOfAddress" => "TitleOfAddress",
                    "TitleOfAddress2" => "TitleOfAddress2",
                    "TitleOfLineageName2" => "TitleOfLineageName2",
                    "TitleOfAddressName2" => "TitleOfAddressName2",
                    "TitleOfAddress2Name2" => "TitleOfAddress2Name2",
                    "PlaceListingAs" => "PlaceListingAs",
                ],
                "Address" => [
                    "HousePrefix" => "HousePrefix",
                    "HouseNumber" => "915",
                    "HouseSuffix" => "HouseSuffix",
                    "PreDirectional" => "PreDirectional",
                    "StreetName" => "StreetName",
                    "StreetSuffix" => "StreetSuffix",
                    "PostDirectional" => "PostDirectional",
                    "AddressLine2" => "AddressLine2",
                    "City" => "City",
                    "StateCode" => "StateCode",
                    "Zip" => "Zip",
                    "PlusFour" => "PlusFour",
                    "Country" => "Country",
                    "AddressType" => "AddressType"
                ]
            ]
        ]
    ]
];

$dlda = $account->dldas()->create($order_data);

Get Dlda

$dlda = $account->dldas()->dlda("7802373f-4f52-4387-bdd1-c5b74833d6e2");

Get Dlda History

$dlda->history();

List Dldas

$account->dldas()->getList(["telephoneNumber" => "9195551212"]);

In Service Numbers

List InService Numbers

$account->inserviceNumbers(["areaCode" => "919"]);

Lidb

Create

$order_data = [
    "LidbTnGroups" => [
        "LidbTnGroup" => [
            [
                "TelephoneNumbers" => [
                    "TelephoneNumber" => "4352154856"
                ],
                "SubscriberInformation" => "Steve",
                "UseType" => "RESIDENTIAL",
                "Visibility" => "PUBLIC"
            ],
            [
                "TelephoneNumbers" => [
                    "TelephoneNumber" => "4352154855"
                ],
                "SubscriberInformation" => "Steve",
                "UseType" => "RESIDENTIAL",
                "Visibility" => "PUBLIC"
            ]
        ]
    ]
];

$lidb = $account->lidbs()->create($order_data);

Get Lidb

$lidb = $account->lidbs()->lidb("7802373f-4f52-4387-bdd1-c5b74833d6e2");

List Lidbs

$lidbs = $account->lidbs()->getList(["lastModifiedAfter" => "mm-dd-yy", "telephoneNumber"=> "888"]);

LNP Checker

Check LNP

$account->lnpChecker(["4109255199", "9196190594"], "true");

Orders

Create Order

$order = $account->orders()->create([
    "Name" => "Available Telephone Number order",
    "SiteId" => "2297",
    "CustomerOrderId" => "123456789",
    "ExistingTelephoneNumberOrderType" => [
        "TelephoneNumberList" => [
            "TelephoneNumber" => [ "9193752369", "9193752720", "9193752648"]
        ]
    ]
]);

Get Order

$response = $account->orders()->order("f30a31a1-1de4-4939-b094-4521bbe5c8df", true); // tndetail=true
$order = $response->Order;

List Orders

$items = $account->orders()->getList();

Add note to order

$order->notes()->create([ "UserId" => "byo_dev", "Description" => "Test Note"]);

Get all Tns for an order

$order->tns()->getList();

Port Ins

Create PortIn

$portin = $account->portins()->create(array(
    "BillingTelephoneNumber" => "6882015002",
    "Subscriber" => array(
        "SubscriberType" => "BUSINESS",
        "BusinessName" => "Acme Corporation",
        "ServiceAddress" => array(
            "HouseNumber" => "1623",
            "StreetName" => "Brockton Ave",
            "City" => "Los Angeles",
            "StateCode" => "CA",
            "Zip" => "90025",
            "Country" => "USA"
        )
    ),
    "LoaAuthorizingPerson" => "John Doe",
    "ListOfPhoneNumbers" => array(
        "PhoneNumber" => array("9882015025", "9882015026")
    ),
    "SiteId" => "365",
    "Triggered" => "false"
));

Get PortIn

$portin = $account->portins()->portin("d28b36f7-fa96-49eb-9556-a40fca49f7c6"));

List PortIns

$portins = $account->portins()->getList(["pon" => "a pon" ]);

PortIn Instance methods

$portin->update();
$portin->delete();
$portin->get_activation_status();
$status = $portin->set_activation_status([
    "AutoActivationDate" => "2014-08-30T18:30:00+03:00"
]);
$portin->history();
$portin->totals();
$portin->notes()->getList();

PortIn File Management

$portin->list_loas(true); // metadata = true
$portin->loas_send("./1.txt");
$portin->loas_update("./1.txt", "1.txt");
$portin->loas_delete("1.txt");
$portin->get_metadata("1.txt");
$meta_new = array(
    "DocumentName" => "text.txt",
    "DocumentType" => "INVOICE"
);
$portin->set_metadata('test.txt', $meta_new);
$portin->delete_metadata('test.txt');

Rate Centers

List Ratecenters

$rc = new \Iris\RateCenter($client);
$cities = $rc->getList(["state" => "CA", "available" => "true"]);

SIP Peers

Create SIP Peer

$sippeer = $account->sippeers()->create(array(
        "PeerName" => "Test5 Peer",
        "IsDefaultPeer" => false,
        "ShortMessagingProtocol" => "SMPP",
        "VoiceHosts" => array(
            "Host" => array(
                "HostName" => "192.168.181.90"
            )
        ),
        "SmsHosts" => array(
            "Host" => array(
                "HostName" => "192.168.181.90"
            )
        ),
        "TerminationHosts" => array(
            "TerminationHost" => array(
                "HostName" => "192.168.181.90",
                "Port" => 0,
                "CustomerTrafficAllowed" => "DOMESTIC",
                "DataAllowed" => true
            )
        )
));

Get SIP Peer

$sippeer = $account->sippeers->sippeer("500651");

List SIP Peers

$sippeers = $account->sippeers()->getList();

Delete SIP Peer

$sippeer->delete();

Move TNs

$sippeer->movetns([ "FullNumber" => [ "9192000046", "9192000047", "9192000048" ]]);

Get TNs

$tns = $sippeer->tns()->getList();

Get TN

$tn = $sippeer->tns()->tn("8183386251");

Total TNs

$count = $sippeer->totaltns();

Set TN Options

$sippeer->tns()->tn("8183386251")->set_tn_options([
    "FullNumber" => "8183386251",
    "CallForward" => "9194394706",
    "RewriteUser" => "JohnDoe",
    "NumberFormat" => "10digit",
    "RPIDFormat" => "e164"
]);

Sites

Create A Site

$site = $account->sites()->create(
    array("Name" => "Test Site",
        "Address" => array(
            "City" => "Raleigh",
            "AddressType" => "Service",
            "HouseNumber" => "1",
            "StreetName" => "Avenue",
            "StateCode" => "NC"
    )));

Updating a Site

$site->Name = "New Name";
$site->update();

Deleting a Site

$site->delete();

Listing All Sites

$sites = $account->sites()->getList();

Orders of a site

$site->orders()->getList(["status" => "disabled"]);

Total TNs of a site

$site->totaltns();

Portins of a site

$site->portins()->getList(["status" => "disabled" ]);

Sippeers

$site->sippeers()->create([...])

[see SIP Peers]

Subscriptions

Create Subscription

$subscription = $account->subscriptions()->create([
    "OrderType" => "portins",
    "OrderId" => "98939562-90b0-40e9-8335-5526432d9741",
    "EmailSubscription" => [
        "Email" => "test@test.com",
        "DigestRequested" => "DAILY"
    ]
]);

Get Subscription

$subscription = $account->subscriptions()->subscription($id);

List Subscriptions

$account->subscriptions()->getList(["orderType" => "portins"]);

Update

$subscription->OrderType = "portins";
$subscription->update();

DELETE

$subscription->delete();

TNs

Get TN

$tns = new Iris\Tns(null, $client);
$tn = $tns->tn($id);

List TNs

$tns = new Iris\Tns(null, $client);
$tns_items = $tns->getList(["page" => 1, "size" => 10 ]);

TN Instance Methods

$tn = $tns->tn("7576768750");
$site = $tn->site();
$sippeer = $tn->sippeer();
$tnreservation = $tn->tnreservation();
$tn->tndetails();
$rc = $tn->ratecenter();
$lata = $tn->lata();
$lca = $tn->lca();

TN Reservation

Create TN Reservation

$resertation = $account->tnsreservations()->create(["ReservedTn" => "2512027430"]);

Get TN Reservation

$resertation = $account->tnsreservations()->tnsreservation("0099ff73-da96-4303-8a0a-00ff316c07aa");

Delete TN Reservation

$resertation = $account->tnsreservations()->tnsreservation("0099ff73-da96-4303-8a0a-00ff316c07aa");
$resertation->delete();

bandwidth-temp/iris 适用场景与选型建议

bandwidth-temp/iris 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 8.67k 次下载、GitHub Stars 达 0, 最近一次更新时间为 2015 年 06 月 22 日, 在 PHP 生态内属于活跃度较高的组件。

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

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

围绕 bandwidth-temp/iris 我们能提供哪些服务?
定制开发 / 二次开发

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-06-22