PHPackages                             fungku/netsuite-php - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. fungku/netsuite-php

ActiveLibrary[API Development](/categories/api)

fungku/netsuite-php
===================

NetSuite PHP API wrapper

v2024.2.0(1y ago)2021.8k87[2 PRs](https://github.com/netsuitephp/netsuite-php/pulls)1Apache-2.0PHPPHP &gt;=8.1

Since Jan 28Pushed 1y ago20 watchersCompare

[ Source](https://github.com/netsuitephp/netsuite-php)[ Packagist](https://packagist.org/packages/fungku/netsuite-php)[ RSS](/packages/fungku-netsuite-php/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (5)Versions (34)Used By (1)

NetSuite PHP API Client
=======================

[](#netsuite-php-api-client)

[![License](https://camo.githubusercontent.com/81dc76799bc7e606602ddc16e675434b21d37748d45be59a6030eccfbd64f80b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f7279616e77696e636865737465722f6e657473756974652d7068702e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/ryanwinchester/netsuite-php)![Packagist](https://camo.githubusercontent.com/fed429d82866855bad641d86a355d3bfc7ca54b9f4b757442178211ddf4e7af1/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7279616e77696e636865737465722f6e657473756974652d7068702e7376673f6d61784167653d32353932303030)

A PHP API client package for NetSuite, pried from the [NetSuite PHP Toolkit](http://www.netsuite.com/portal/developers/resources/suitetalk-sample-applications.shtml)and made more consumable for modern PHP application development. All of the classes in the `NetSuite\Classes` namespace are code provided by NetSuite with a [license](#license) allowing redistribution. The custom work provided by this library separates these nearly 2,000 classes out into their own files and allows the classes to be installed with composer and accessed using standard autoloading support. It allows configuration to be read from the environment, adds support to log requests and responses and provides a simplified client wrapper class (`NetSuiteService`).

- [Installation](#installation)
- [Quickstart](#quickstart)
    - [w/Laravel](#laravel-integration)
- [Account-Specific Data Center URLs](#Account-Specific-Data-Center-URLs)
- [Examples](#examples)
- [Logging](#logging)
- [Generating Classes](#generating-classes)
- [Roadmap](#roadmap)
- [Support](#support)
- [Contributing](#contributing)
- [License](#license)

Installation
------------

[](#installation)

Require with composer:

```
composer require ryanwinchester/netsuite-php

```

Quickstart:
-----------

[](#quickstart)

#### Instantiating the NetSuiteService class:

[](#instantiating-the-netsuiteservice-class)

Any of the examples herein will assume you have already instantiated a client object using token-based authentication. The method of authenticating with user credentials was dropped from support by NetSuite in 2020.

```
// Token-based Authentication
require 'vendor/autoload.php';

use NetSuite\NetSuiteService;

$config = [
    // required -------------------------------------
    "endpoint"       => "2021_1",
    "host"           => "https://webservices.netsuite.com",
    "account"        => "MYACCT1",
    "consumerKey"    => "0123456789ABCDEF",
    "consumerSecret" => "0123456789ABCDEF",
    "token"          => "0123456789ABCDEF",
    "tokenSecret"    => "0123456789ABCDEF",
    // optional -------------------------------------
    "signatureAlgorithm" => 'sha256', // Defaults to 'sha256'
    "logging"  => true,
    "log_path" => "/var/www/myapp/logs/netsuite",
    "log_format"     => "netsuite-php-%date-%operation",
    "log_dateformat" => "Ymd.His.u",
];
$service = new NetSuiteService($config);
```

You can alternatively place your config in environment variables. This is helpful in hosted environments where deployment of config files is either not desired or practical. You can find the valid keys in the included `.env.example` file with sample values.

Previously, instantiating the NetSuiteClient with ENV data entailed using the static method `createFromEnv`. This method is now marked as `deprecated` and if you are using it, please change your code to use the standard constructor which will extract your configuration out of the $\_ENV superglobal for you.

```
// Allowing the client to infer configuration from $_ENV
require 'vendor/autoload.php';

use NetSuite\NetSuiteService;

$service = new NetSuiteService();
```

### Laravel Integration

[](#laravel-integration)

If you're implementing NetSuite web services in a [Laravel](https://laravel.com) application, you might want to look at the [netsuite-laravel](https://github.com/netsuitephp/netsuite-laravel) package to streamline instantiating and making the client available to your app via the service container. In that case, you'll simply need to require the `netsuitephp/netsuite-laravel` package in your application and then as long as the client configuration is present in the application's environment, you'll have a client instance in the container.

Account-Specific Data Center URLs
---------------------------------

[](#account-specific-data-center-urls)

With `2021_1`, this library provides support to utilize NetSuite's new account-specific data center URL detection on each request. In practice, this lookup does have a measurable overhead cost. As such, I'd suggest using this feature only if your manner of NetSuite integration is such that you make fewer connections, handling integration in batches. If your manner of integration is to instead make many frequent, brief requests from NetSuite, then you will probably prefer to provide your data center URL explicitly and remove the lookup from every session.

```
// Recommended: Use your own defined data center URL (or sandbox, for instance):
$config['host'] = 'https://123456789.suitetalk.api.netsuite.com';

// To allow the service to get the correct URL for your account on the fly,
// use the legacy webservices url.
$config['host'] = 'https://webservices.netsuite.com';
```

Examples
--------

[](#examples)

See [EXAMPLES.md](EXAMPLES.md)

Logging
-------

[](#logging)

The most common way to enable logging will be to do so at the configuration level, see the [quickstart](#quickstart) examples.

You can also set logging on or off during runtime with methods. Note that if you don't specify a logging directory in the config or at runtime, then no logs will be created. There must be a valid target location.

```
// Set a logging path
$service->setLogPath('/path/to/logs');

// Turn logging on
$service->logRequests(true);  // Turn logging on.

// Turn logging off
$service->logRequests(false); // Turn logging off.
```

If you require more flexibility in relation to logging, you can provide your own PSR-3 compatible logger (as of `2023.1.0`).

Generating Classes
------------------

[](#generating-classes)

This repository always contains classes generated from the version of the NetSuite PHP Toolkit corresponding with the web services version denoted by the specific release. Release `v2021.1.0`, for instance, is the first release built against NetSuite's `2021_1` web services toolkit. If you want to generate the class files yourself, for whatever reason, there is code included with the package to do so, using the following steps:

- Download the [NetSuite PHP Toolkit](http://www.netsuite.com/portal/developers/resources/suitetalk-sample-applications.shtml)
- Unzip the contents into the `./original/` folder
- Run `./utilities/separate_classes.php` or `composer generate`

Roadmap
-------

[](#roadmap)

#### PHP Version Support

[](#php-version-support)

See:

With official support for PHP5 gone since the end of 2018 and with PHP7 moving to security-only by the end of 2021, the versions of PHP supported by this package will start to be gradually moved forward.

For the time being, expect the following for `netsuitephp/netsuite-php`:

- require `"php": ">=7.1"` as of the `2021_1` build
- require `"php": ">=8"` as of the `2023_1` build

**This will apply only to new releases of the package, so you will still be able to continue using the last supported version for your PHP release if you can't or won't update PHP.**

Support
-------

[](#support)

If you need help with implementation, see the [resources section](EXAMPLES.md#resources) of the examples file for some useful links.

If you believe that your issue is a bug specific to the custom work provided by this package (and not NetSuite's own classes that are packaged therein), then you can file an issue in github. Per the issue template, please include a clear description of the problem, how it is reproduced and the logs of relevant requests/responses using the logging features of this package.

Contributing
------------

[](#contributing)

Contributions are welcome in the form of pull requests. Please include a clear explanation of the reason for the change and try to keep changes as small as possible, which will increase the speed with which we can get them reviewed and the likelihood of being included into the master branch.

- Make sure to respect the current required `php` version in `composer.json`
- Avoid introducing new dependencies (no framework hooks, etc)
- Please try to make all additions comply with [PSR-12](https://www.php-fig.org/psr/psr-12/)

License
-------

[](#license)

[Original work](http://www.netsuite.com/portal/developers/resources/suitetalk-sample-applications.shtml) is Copyright © 2010-2015 NetSuite Inc. and provided "as is." Refer to the [NetSuite Toolkit License Agreement](original/NetSuite%20Application%20Developer%20License%20Agreement.txt) file.

All additional work is licensed under the **Apache 2.0** open source software license according to the included [LICENSE](LICENSE.txt) file.

###  Health Score

51

—

FairBetter than 96% of packages

Maintenance42

Moderate activity, may be stable

Popularity36

Limited adoption so far

Community32

Small or concentrated contributor base

Maturity83

Battle-tested with a long release history

 Bus Factor2

2 contributors hold 50%+ of commits

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~114 days

Recently: every ~240 days

Total

33

Last Release

471d ago

Major Versions

v2019.2.1 → v2020.1.02020-07-30

v2020.2.1 → v2021.1.02021-10-05

v2021.2.0 → v2022.1.02022-06-06

v2022.1.1 → v2023.1.02023-06-28

v2023.2.0 → v2024.2.02025-01-24

PHP version history (3 changes)v1.1.0PHP &gt;=5.3.0

v2021.1.0PHP &gt;=7.1

v2023.2.0PHP &gt;=8.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/f839bc1a48d9699534fdfd618ad477afe371e9ce70c76885a5cb851895ab7289?d=identicon)[ryanwinchester](/maintainers/ryanwinchester)

---

Top Contributors

[![ryanwinchester](https://avatars.githubusercontent.com/u/2897340?v=4)](https://github.com/ryanwinchester "ryanwinchester (72 commits)")[![jrebs](https://avatars.githubusercontent.com/u/4203789?v=4)](https://github.com/jrebs "jrebs (46 commits)")[![neclimdul](https://avatars.githubusercontent.com/u/82823?v=4)](https://github.com/neclimdul "neclimdul (17 commits)")[![es02](https://avatars.githubusercontent.com/u/1310970?v=4)](https://github.com/es02 "es02 (5 commits)")[![bendavies](https://avatars.githubusercontent.com/u/625392?v=4)](https://github.com/bendavies "bendavies (4 commits)")[![skylord123](https://avatars.githubusercontent.com/u/3412313?v=4)](https://github.com/skylord123 "skylord123 (4 commits)")[![balintbrews](https://avatars.githubusercontent.com/u/297418?v=4)](https://github.com/balintbrews "balintbrews (2 commits)")[![mbvb1223](https://avatars.githubusercontent.com/u/11681514?v=4)](https://github.com/mbvb1223 "mbvb1223 (1 commits)")[![patforg](https://avatars.githubusercontent.com/u/792553?v=4)](https://github.com/patforg "patforg (1 commits)")[![r-phelan](https://avatars.githubusercontent.com/u/5914294?v=4)](https://github.com/r-phelan "r-phelan (1 commits)")[![scrutinizer-auto-fixer](https://avatars.githubusercontent.com/u/6253494?v=4)](https://github.com/scrutinizer-auto-fixer "scrutinizer-auto-fixer (1 commits)")[![serhiimakarov](https://avatars.githubusercontent.com/u/15029756?v=4)](https://github.com/serhiimakarov "serhiimakarov (1 commits)")[![alex-volga](https://avatars.githubusercontent.com/u/1820758?v=4)](https://github.com/alex-volga "alex-volga (1 commits)")[![troyporter](https://avatars.githubusercontent.com/u/1162790?v=4)](https://github.com/troyporter "troyporter (1 commits)")[![awarrenlove](https://avatars.githubusercontent.com/u/3413482?v=4)](https://github.com/awarrenlove "awarrenlove (1 commits)")[![boaf](https://avatars.githubusercontent.com/u/341348?v=4)](https://github.com/boaf "boaf (1 commits)")[![fahmiardi](https://avatars.githubusercontent.com/u/1201482?v=4)](https://github.com/fahmiardi "fahmiardi (1 commits)")[![FSElias](https://avatars.githubusercontent.com/u/6896769?v=4)](https://github.com/FSElias "FSElias (1 commits)")[![Justinas-Jurciukonis](https://avatars.githubusercontent.com/u/33222536?v=4)](https://github.com/Justinas-Jurciukonis "Justinas-Jurciukonis (1 commits)")[![kissifrot](https://avatars.githubusercontent.com/u/105998?v=4)](https://github.com/kissifrot "kissifrot (1 commits)")

---

Tags

api-clientnetsuitephpsoap-clientphpapinetsuite

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/fungku-netsuite-php/health.svg)

```
[![Health](https://phpackages.com/badges/fungku-netsuite-php/health.svg)](https://phpackages.com/packages/fungku-netsuite-php)
```

###  Alternatives

[algolia/algoliasearch-client-php

API powering the features of Algolia.

69333.0M114](/packages/algolia-algoliasearch-client-php)[ryanwinchester/netsuite-php

NetSuite PHP API wrapper

2012.6M5](/packages/ryanwinchester-netsuite-php)[theodo-group/llphant

LLPhant is a library to help you build Generative AI applications.

1.5k311.5k5](/packages/theodo-group-llphant)[comgate/sdk

Comgate PHP SDK

13327.8k](/packages/comgate-sdk)[netsuitephp/netsuite-laravel

NetSuite PHP laravel provider wrapper

11201.0k](/packages/netsuitephp-netsuite-laravel)[rubix/server

Deploy your Rubix ML models to production with scalable stand-alone inference servers.

632.3k](/packages/rubix-server)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
