LogicBoxes package provides most of the LogicBoxes API functionality and compatible company apis like resellerclub, whois.com and many more.
This package mainly developed for laravel package but you can use as a standalone package.
composer require netinternet/logicboxes
Package should be autodiscover by default but if you are using older versions of laravel you should change config/app.php with below;
Add this in providers array;
Netinternet\Logicboxes\LogicboxesServiceProvider::class,Add this in aliases array;
'Logicboxes'=>Netinternet\Logicboxes\Facades\Logicboxes::class,Use command below and choose logicboxes option when asked. It will create logicboxes.php in config directory.
php artisan vendor:publishYou can also create this file manually and paste below content in file;
<?phpreturn [
'mode' => env('LOGICBOXES_ENV', 'test'),
'auth-userid' => env('LOGICBOXES_AUTHID'),
'api-key' => env('LOGICBOXES_APIKEY')
];As you can see by default package uses environment variables. Be sure that use test mode when development mode. We strongly recommend to create LogicBox Demo Account
You can choose to use facade or helper function. We will use helper functions for examples in this documentation.
useLogicboxes;
// With FacadepublicfunctionmyMethod()
{
return Logicboxes::domain('domain-name.tld')->ns();
}or with helper
publicfunctionmyMethod()
{
returnlogicboxes()->domain('domain-name.tld')->ns();
}// get domain nameservers.logicboxes()->domain('domain-name.tld')->nameservers();
// get domain nameservers short.logicboxes()->domain('domain-name.tld')->ns();
// get domains all details.logicboxes()->domain('domain-name.tld')->details();
// get domains statuslogicboxes()->domain('domain-name.tld')->status();
// get domains order detailslogicboxes()->domain('domain-name.tld')->order();
// get domains dnssec detailslogicboxes()->domain('domain-name.tld')->dnssec();
// get domains contact id list.logicboxes()->domain('domain-name.tld')->contact()->ids();
// get domains registrant contact detailslogicboxes()->domain('domain-name.tld')->contact()->registrant();
// get domains admin contact detailslogicboxes()->domain('domain-name.tld')->contact()->admin();
// get domains tech contact detailslogicboxes()->domain('domain-name.tld')->contact()->tech();
// get domains billing contact detailslogicboxes()->domain('domain-name.tld')->contact()->billing();
// check for domainlogicboxes()->domain('domain-name')->check(['com','net'])
// first parameter is array of tlds and second parameter domain suggessions as a boolean. Default is false.// and you can also set domain index as third parameter for getting immediate domain status without result//object ```logicboxes()->domain('domain-name')->check(['com','net'],false,1)```// get domain order idlogicboxes()->domain('domain-name.tld')->orderId();
// set enable theft protectionlogicboxes()->domain('domain-name.tld')->enableTheftProtection();
// set disable theft protectionlogicboxes()->domain('domain-name.tld')->disableTheftProtection();
// modify domain nameserverslogicboxes()->domain('domain-name.tld')->modifyNameServers((array) $ns);
// delete this domainlogicboxes()->domain('domain-name.tld')->delete();
// cancel domain transfer processlogicboxes()->domain('domain-name.tld')->cancelTransfer();
// register domainlogicboxes()->domain('domain-name.tld')->register([
'years' => $years,
'ns' => (array) $ns,
'customer-id' => $customerId,
'reg-contact-id' => $regContactId,
'admin-contact-id' => $adminContactId,
'tech-contact-id' => $techContactId,
'billing-contact-id' => $billingContactId,
'invoice-option' => 'KeepInvoice',
'purchase-privacy' => $purchasePrivacy,
'protect-privacy' => $protectPrivacy,
]);
// Domain transferlogicboxes()->domain('domain-name.tld')->transfer([
'auth-code' => $authCode,
'years' => $years,
'ns' => (array)$ns,
'customer-id' => $customerId,
'reg-contact-id' => $regContactId,
'admin-contact-id' => $adminContactId,
'tech-contact-id' => $techContactId,
'billing-contact-id' => $billingContactId,
'invoice-option' => $invoiceOption,
'purchase-privacy' => $purchasePrivacy,
'protect-privacy' => $protectPrivacy,
]);
// set Auth Codelogicboxes()->domain('domain-name.tld')->authCode('authcode');
// modify Auth Codelogicboxes()->domain('domain-name.tld')->modifyAuthCode('authcode');
// modify Auth Codelogicboxes()->domain('domain-name.tld')->validateTransferRequest();
// renew domain ($date => epochtime)logicboxes()->domain('domain-name.tld')->renew($years, $date, $invoiceOption, true);
// $purchasePrivacy is default false// deafult customer nameserverslogicboxes()->domain()->customerDefaultNameServers($customerId);
// Check premiumlogicboxes()->domain('domain-name.tld')->isDomainPremium();
// add new child nameserverlogicboxes()->domain('domain-name.tld')->addChildNs('ns1.domain.com', ['0.0.0.0', '0.0.0.1']);
// get lock applied listlogicboxes()->domain('domain-name.tld')->getListLockApplied();
// set suspendlogicboxes()->domain('domain-name.tld')->suspend('reason text');
// set unsuspendlogicboxes()->domain('domain-name.tld')->unSuspend();// Creating a customerlogicboxes()->customer()->create([
'username' => $this->faker->email,
'passwd' => 'Qs3jiA5fd8mq4',
'name' => $this->faker->name,
'company' => $this->faker->company,
'address-line-1' => $this->faker->streetAddress,
'city' => $this->faker->city,
'state' => $this->faker->state,
'country' => $this->faker->countryCode,
'zipcode' => $this->faker->postcode,
'phone-cc' => 90,
'phone' => 5555555555,
'lang-pref' => 'en'
]);
// getting a customer by email or idlogicboxes()->customer()->get('app@yourdomain.com')
//or by idlogicboxes()->customer()->get(17939294)
// Changing customers passwordlogicboxes()->customer()->get('app@yourdomain.com','myNew8CharPassword')
// Change customerlogicboxes()->customer()->moveProduct("app@yourdomain.com", 'old-customer-id', 'new-customer-id, 'old-contact');- You should first open the LogicBox test account LogicBox Demo Account Link
- Copy example config file:
cp tests/config.ini.example tests/config.ini- Change credentials in tests/config.ini file.
- Run phpunit:
$ vendor/phpunit/phpunit/phpunit - Fork it ( https://github.com/netinternet/logicboxes-api/ )
- Create your feature branch (git checkout -b my-new-feature)
- Commit your changes (git commit -am 'Add some feature')
- Push to the branch (git push origin my-new-feature)
- Create a new Pull Request