PHPackages                             danmichaelo/ncip - 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. danmichaelo/ncip

AbandonedLibrary

danmichaelo/ncip
================

Basic NCIP library

v0.2.3(11y ago)33081[1 PRs](https://github.com/scriptotek/php-ncip/pulls)MITPHPPHP &gt;=5.3.0

Since Feb 12Pushed 4y ago4 watchersCompare

[ Source](https://github.com/scriptotek/php-ncip)[ Packagist](https://packagist.org/packages/danmichaelo/ncip)[ Docs](http://github.com/scriptotek/php-ncip)[ RSS](/packages/danmichaelo-ncip/feed)WikiDiscussions master Synced 3d ago

READMEChangelogDependencies (7)Versions (5)Used By (0)

Basic NCIP php library and Laravel package
==========================================

[](#basic-ncip-php-library-and-laravel-package)

[![Build Status](https://camo.githubusercontent.com/273e56534d169ce0f1e00411c438dcd8a799191d3dcbb747eb2cd137012f89fb/687474703a2f2f696d672e736869656c64732e696f2f7472617669732f7363726970746f74656b2f7068702d6e6369702e7376673f7374796c653d666c6174)](https://travis-ci.org/scriptotek/php-ncip)[![Coverage Status](https://camo.githubusercontent.com/650aff2a62ca4e242b57f68d0ff2cd1cc69fdb8a96e15970d3d3be0b3428c670/687474703a2f2f696d672e736869656c64732e696f2f636f766572616c6c732f7363726970746f74656b2f7068702d6e6369702e7376673f7374796c653d666c6174)](https://coveralls.io/r/scriptotek/php-ncip?branch=master)[![Latest Stable Version](https://camo.githubusercontent.com/b8cd3f3c71d081a77cea99f8d0d0984ada2710cf5a23cc19b18e70aae0ff4cd3/687474703a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f64616e6d69636861656c6f2f6e6369702e7376673f7374796c653d666c6174)](https://packagist.org/packages/danmichaelo/ncip)[![Total Downloads](https://camo.githubusercontent.com/4b0d604c28ceb3006ce61d4068c2884dbfc62cb352c6b5227790718fcad40c60/687474703a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f64616e6d69636861656c6f2f6e6369702e7376673f7374796c653d666c6174)](https://packagist.org/packages/danmichaelo/ncip)[![License](https://camo.githubusercontent.com/6e5f40da8c30c89bcf3dd1da0a05a7da7023917707e7ce487d81b18f0eceacc9/687474703a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f64616e6d69636861656c6f2f6e6369702e7376673f7374796c653d666c6174)](https://packagist.org/packages/danmichaelo/ncip)

**php-ncip** is a php package for parsing and formatting NCIP request and response messages. Development has been guided by a desire for a simple API rather than a complete one. Only a small subset of the NCIP specification is currently covered, but suggestions for additions are welcome.

Installation:
-------------

[](#installation)

### Composer

[](#composer)

Add the package to the `require` list of your `composer.json` file.

```
{
    "require": {
        "danmichaelo/ncip": "dev-master"
    },
}
```

and run `composer install` to get the latest version of the package.

### Additional steps for Laravel 4

[](#additional-steps-for-laravel-4)

The package comes with a Laravel 4 service provider that you can install if you like. It comes with a config file, so you can set settings there instead of passing them to the constructor.

To register the service provider, add `'Scriptotek\NcipServiceProvider',` to the list of `providers` in `app/config/app.php`. Then run `php artisan config:publish danmichaelo/ncip` in your terminal to create the config file `app/config/packages/danmichael/ncip/config.php`.

Usage:
------

[](#usage)

### Construction

[](#construction)

To construct a client, you need to specify the url to the NCIP srvice, a freely choosen user agent string for your client, and the agency id. The agency id identifies your institution, as specified in the NCIP protocol.

```
require_once('vendor/autoload.php');
use Scriptotek\Ncip\NcipConnector,
    Scriptotek\Ncip\NcipClient;

$ncipUrl = 'http://eksempel.com/NCIPResponder';
$userAgent = 'My NCIP client/0.1';
$agencyId = 'a';

$conn = new NcipConnector($ncipUrl, $userAgent, $agencyId);
$client = new NcipClient($conn);
```

To construct a server:

```
require_once('vendor/autoload.php');
use Scriptotek\Ncip\NcipServer;

$server = new NcipServer;
```

If you have registered the Laravel 4 service provider, the classes can be constructed through the applications container instead:

```
$client = App::make('ncip.client');
$server = App::make('ncip.server');

// Or if you have access to an instance of the application.
$client = $app['ncip.client'];
$server = $app['ncip.server'];
```

The settings are now pulled from `app/config/packages/danmichael/ncip/config.php` instead, and the `NcipConnector` is injected into the `NcipClient` automatically.

### Client example:

[](#client-example)

```
$user = $client->lookupUser('abc123');
if ($user->exists) {
	echo 'Hello ' . $user->firstName . ' ' . $user->lastName;
} else {
	echo 'User not found';
}
```

### Server example:

[](#server-example)

```
$postData = file_get_contents('php://input');
$request = $server->parseRequest($postData);

if ($request->is('LookupUser')) {

	$response = new UserResponse;
	$response->userId = $request->userId;
	$response->firstName = 'Meriadoc';
	$response->lastName = 'Brandybuck';
	echo $response->xml();

}
```

### Events:

[](#events)

The client emits events on each request to the server. This can be useful to implement logging. The events are `request.item`, `request.user`, `request.checkout`, `request.checkin` and `request.renew`.

```
$client->on('request.checkout', function($userId, $itemId) {
	$log->addInfo('Requested checkout of item "' . $itemId . '" for user "' . $userId . '"');
}
```

For debugging, events `message.send` and `message.recv` are emitted on each message sent to and received from the server. The message xml body is given as the first argument.

```
$client->on('message.send', function($msg) {
	printf("[SEND] %s\n", $msg);
}
$client->on('message.recv', function($msg) {
	printf("[RECV] %s\n", $msg);
}
```

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity16

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity51

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 98.1% of commits — single point of failure

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 ~45 days

Total

5

Last Release

4292d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/87db1d80793d2adbeca18997c33acbb5cf1dec75ccc5c19f147d666dfbf2e990?d=identicon)[danmichaelo](/maintainers/danmichaelo)

---

Top Contributors

[![danmichaelo](https://avatars.githubusercontent.com/u/434495?v=4)](https://github.com/danmichaelo "danmichaelo (101 commits)")[![bitdeli-chef](https://avatars.githubusercontent.com/u/3092978?v=4)](https://github.com/bitdeli-chef "bitdeli-chef (1 commits)")[![scrutinizer-auto-fixer](https://avatars.githubusercontent.com/u/6253494?v=4)](https://github.com/scrutinizer-auto-fixer "scrutinizer-auto-fixer (1 commits)")

---

Tags

laravelncip

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/danmichaelo-ncip/health.svg)

```
[![Health](https://phpackages.com/badges/danmichaelo-ncip/health.svg)](https://phpackages.com/packages/danmichaelo-ncip)
```

###  Alternatives

[laravel/horizon

Dashboard and code-driven configuration for Laravel queues.

4.2k84.2M225](/packages/laravel-horizon)[laravel/cashier

Laravel Cashier provides an expressive, fluent interface to Stripe's subscription billing services.

2.5k25.9M107](/packages/laravel-cashier)[spatie/laravel-responsecache

Speed up a Laravel application by caching the entire response

2.8k8.2M51](/packages/spatie-laravel-responsecache)[spatie/laravel-ignition

A beautiful error page for Laravel applications.

566146.7M471](/packages/spatie-laravel-ignition)[laravel/pulse

Laravel Pulse is a real-time application performance monitoring tool and dashboard for your Laravel application.

1.7k12.1M99](/packages/laravel-pulse)[php-open-source-saver/jwt-auth

JSON Web Token Authentication for Laravel and Lumen

8359.8M53](/packages/php-open-source-saver-jwt-auth)

PHPackages © 2026

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