PHP Classes


Recommend this page to a friend!
  Classes of nvb   PHP Unique Number Repository   Download  
Role: Documentation
Content type: text/markdown
Description: Documentation
Class: PHP Unique Number Repository
Maintain repositories of unique numbers via an API
Author: By
Last change:
Date: 3 years ago
Size: 6,164 bytes


Class file image Download

Unique Number Repository Webservice

Sometimes, you simple need to make sure you can fetch a unique number for a given problem scope. To easy things up, this project will create a rest based webservice as backend and a command line frontend to support you solving this problem.

REST Based Backend (Server)

  • endpoint s * "/unique-number-repository" * DELETE: deleted a repository and all its unique numbers * GET: returns list of all repository names * PUT: creates a new repository * "/unique-number-repository/{name}" * DELETE: deletes a number from this repository * GET: returns list of all numbers from this repository * PUT: creates a new number for this repository

Command Line Based Frontend (Client)


By Hand

mkdir -p vendor/net_bazzline/unique_number_repository
cd vendor/net_bazzline/unique_number_repository
git clone .

With Packagist

composer require net_bazzline/unique_number_repository:dev-master


By Hand

cd <project root>/configuration
cp client.local.php.dist client.local.php
#adapt client.local.php
cp server.local.php.dist server.local.php
#adapt server.local.php

With setup

cd <project root>


  • implement token authentication (you can and should override the existing token by creating your own client.local.php and server.local.php in configuration)


API is available at



  • upcomming * @todo * multiple storage (databases) are supported (right now, file storage is supported) * return the right status code (403 instead of 404) if a user tries to delete a number he does not own
  • 0.13.0 - released at 06.03.2016 * moved to psr-4 autoloading
  • 0.12.3 - released at 18.12.2015 * updated dependency
  • 0.12.2 - released at 19.11.2015 * updated dependency
  • 0.12.1 - released at 18.11.2015 * updated dependency
  • 0.12.0 - released at 30.09.2015 * changed "not authorized" http status code from wrong 403 to right 401 * introduced right usage of 403
  • 0.11.0 - released at 20.09.2015 * added restriction that only the creator (repository or number) can delete the resource
  • 0.10.4 - released at 16.09.2015 * fixed issue in authorization request * made https an optional requirement * updated * updated dependency
  • 0.10.3 - released at 14.09.2015 addedAPI* section * updated dependencies
  • 0.10.2 - released at 13.09.2015 addedsetup* script to easy up after installation configuration
  • 0.10.1 - released at 13.09.2015 * fixed authentication problem
  • 0.10.0 - released at 13.09.2015 * downgraded to silex 1.2 to support php 5.3.3 * fixed broken links * increased compatibility by using '/usr/bin/env' for client code * removed unused dependencie
  • 0.9.0 - released at 12.09.2015 * silix based server/backend

Final Words

Star it if you like it :-). Add issues if you need it. Pull patches if you enjoy it. Write a blog entry if you use it. Donate something if you love it :-].