Storage Boxx PHP Inventory System (With QR & NFC Scanner)

Storage Boxx is an open-source PHP Inventory Management System. It is not a “super professional crazy bloated with features” kind of system. But it covers the basics, has a built-in webcam QR code scanner, built-in NFC scanner, and low stock warning push notifications. This will help small businesses get started with inventory stock keeping.

 

TABLE OF CONTENTS

 

 

DOWNLOAD & INSTALLATION

First, here are the download links and a quick “setup guide” for the impatient folks who don’t have the patience to read through everything.

 

LICENSE & DOWNLOAD

Storage Boxx is released under the MIT License. You are free to use it for personal and commercial projects, and modify it as you see fit. On the condition that the software is provided “as-is”. There are no warranties provided and “no strings attached”. Code Boxx and the authors are not liable for any claims, damages, or liabilities.

Download Storage Boxx | GitHub | SourceForge

 

SYSTEM REQUIREMENTS

  • LAMP/WAMP/MAMP/XAMPP
  • Apache Mod Rewrite
  • PHP MYSQL PDO Extension
  • At least PHP 8.0

 

INSTALLATION

Just access http://your-site.com in your browser and walk through the installer.

 

EQUIPMENT RECOMMENDATIONS

  • A simple USB QR Code scanner only costs like 30~40 bucks these days – Get yourself one if you don’t already have one.
  • NFC tags ain’t that bad either – 10 pieces of Ntag213 only cost 2-3 bucks. Buy them in bulk, and one piece will only cost a few cents.

 

 

HOW TO USE

So far so good? Let us now go through a quick crash course on how to use Storage Boxx.

 

STEP 1) REGISTER ITEMS

  • Inventory > Items > Click on “+”.
  • Either register your items one-by-one, or mass import them from a CSV file.
  • Print out the QR code or create NFC tags if you want – It does speed things up and makes things easier to manage.

 

STEP 2) UPDATE STOCK MOVEMENT

  • Inventory > Movement.
  • This should be self-explanatory. Fill in and update the stock levels whenever required.

 

STEP 3) CHECK STOCK LEVELS

To check an item:

  • Manually type in the SKU.
  • Or use a USB barcode scanner.
  • Or scan the NFC tag.
  • Or scan the QR code.

 

 

STORAGE BOXX FAQ

Storage Boxx is “not working”? Here are a few of the common problems and how to “fix” them.

 

I DELETED ALL ADMIN ACCOUNTS

recover.php
require "lib/CORE-Go.php";
$_CORE->load("Users");
$_CORE->Users->save("NAME", "EMAIL", "PASSWORD");

Just create an “account recovery” script to create a new account. Run and delete this afterward.

 

CHANGED DOMAIN OR PATH

  • Update HOST_BASE in lib/CORE-Config.php. Make sure to include the path (with a trailing slash) if not deployed at the base URL. E.G. http://site.com/storageboxx/
  • Delete the existing .htaccess file.
  • Create init.php.
    • require "lib/CORE-Go.php";
    • $_CORE->Route->init();
  • Access http://site.com/init.php, this will automatically regenerate the .htaccess file.
  • Delete init.php.
  • Clear the service worker and browser cache if you want to be “totally safe”.

 

PAGES ARE NOT RESOLVING OR SHOWING PROPERLY

  • Make sure that MOD_REWRITE is enabled in Apache.
  • Make sure that AllowOverride is set properly in Apache.
  • If using https://, make sure that your SSL cert and virtual host are properly set.
  • In Mac/Linux, make sure that Apache/PHP has permission to read the files and folders.

Here is a quick “working example” of a test site on my WAMP server:

httpd.conf OR httpd-vhosts.conf
<VirtualHost site.com:443>
  DocumentRoot "D:\http"
  ServerName site.com:443
  SSLEngine On
  SSLCertificateFile "C:/xampp/apache/conf/ssl.crt/server.crt"
  SSLCertificateKeyFile "C:/xampp/apache/conf/ssl.key/server.key"
  <Directory "D:\http">
    Options Indexes FollowSymLinks Includes ExecCGI
    AllowOverride All
    Require all granted
  </Directory>
</VirtualHost>

 

MANUAL INSTALLATION

  • Create a database and import all lib/SQL-*.sql in ascending order.
  • Open lib/CORE-Config.php, update the settings to your own.
    • The host settings.
    • Database settings.
    • If you want to develop mobile apps, consider enabling CORS.
    • Set your own JWT secret key, and the issuer to your domain or company name.
  • Run $_CORE->Route->init() to create .htaccess.
  • Create your own admin user. See “deleted all admin accounts” above.
  • Update index.php.
    • require __DIR__ . DIRECTORY_SEPARATOR . "lib" . DIRECTORY_SEPARATOR . "CORE-Go.php";
    • $_CORE->load("Route");
    • $_CORE->Route->run();

 

I WANT TO CHANGE THE DATE FORMAT

Login > under system settings section > there are 4 “MYSQL date/time format” settings, change them accordingly. These are simply formats for the MYSQL DATE_FORMAT() function.

 

NOT WORKING. DON’T KNOW WHY.

Open the developer’s console, reload the page and see the error message.

 

 

NFC FEATURES ARE “NOT WORKING”!

At the time of writing, Web NFC only works on Android Chrome and Baidu Browser – CanIUse

 

QUICK REFERENCE

This section is for the developers, a quick walkthrough of the general system structures.

 

FOLDER STRUCTURE

  • assets/ Public images, Javascript, CSS, etc…
  • lib/ Core engine and library files.
    • API-AAA.php The API endpoints. Will be deployed at http://site.com/api/AAA/.
    • CORE-CCC.php Core engine files. Try not to mess with these.
    • LIB-LLL.php Library files.
    • SQL-SSS.php SQL database files. Can actually delete these after installation.
  • pages/ HTML pages and template.
    • PAGE-PPP.php “Normal” pages. Will be deployed at http://site.com/PPP/.
    • REPORT-Loader.php A “special page” to generate reports.
    • TEMPLATE-TTT.php HTML page template.
    • MAIL-MMM.php Email templates.

 

THE FRAMEWORKS

Storage Boxx is built with:

 

DATABASE TABLES

USERS

users
Field Description
user_id The user ID, primary key.
user_name
The user name.
user_email
The user’s email address.
user_password
The password. Encrypted.
user_token NFC login token.
password_reset – Forgotten password recovery.
Field Description
user_id User ID, primary and foreign key.
reset_hash Password reset security hash.
reset_time Timestamp when the reset request is made. Spam prevention.

 

SYSTEM

settings
Field Description
setting_name Primary key.
setting_description Description of the setting.
setting_value The value of the setting.
setting_group Setting group.

  • 0 – “Hidden” system settings and definitions.
  • 1 – User changeable settings.
webpush
Field Description
endpoint Primary key, web push endpoint.
data JSON-encoded subscription object.

 

ITEMS

stock – The list of inventory items.
Field Description
stock_sku The SKU of the item, primary key.
stock_name Name of the item.
stock_desc Description of the item.
stock_unit Unit of measurement.
stock_low For low stock monitoring. Set to 0 for “no monitoring”.
stock_qty Current quantity in stock.
stock_mvt – Stock movement history.
Field Description
stock_sku The SKU of the item. Primary key.
mvt_date Date of movement entry. Primary key.
mvt_direction The direction of the movement.

  • I – Stock In (receive)
  • O – Stock Out (release)
  • T – Stock Take (audit)
  • D – Discard (dispose)
user_id The user who made this movement entry.
mvt_qty Quantity moved.
mvt_notes Notes, if any.

 

 

DEVELOPING STORAGE BOXX

As simple as it may be, going through the entire system is still going to take some time. So instead of “explaining line-by-line”, here is a condensed version of “how to quickly customize and upgrade”.

 

CORE BOXX LIBRARY REFERENCE

For most of the core modules, you can refer to the Core Boxx reference library.

 

STEP 1) CREATE/MODIFY DATABASE TABLES

Add your new tables or views, modify the existing ones.

 

STEP 2) ADD/UPDATE SYSTEM MODULES

lib/LIB-Report.php
class Report extends Core {
  function getMoveByUser ($id) {
    return $this->DB->fetchAll(
      "SELECT * FROM `stock_mvt` WHERE `user_id`=? ORDER BY `mvt_date` DESC", [$id]
    );
  }
}

To add a new module:

  • Create lib/LIB-Module.php.
  • Define class Module extends Core.
  • Add functions inside.

In this example, we add a new report module – lib/LIB-Report.php and class Report extends Core. That’s all. This new module can now be loaded via $_CORE->load("Report") and the function can be accessed via $_CORE->Report->getMoveByUser().

 

 

STEP 3) ADD/UPDATE API ENDPOINT (OPTIONAL)

lib/API-report.php
// (A) REGISTERED USERS ONLY
if (!isset($_SESS["user"])) {
  $_CORE->respond(0, "Please sign in first", null, null, 403);
}
 
switch ($_REQ) {
  // (B) INVALID REQUEST
  default:
    $_CORE->respond(0, "Invalid request", null, null, 400);
    break;
 
  // (C) MOVE BY USER REPORT
  case "getMoveByUser":
    $_CORE->autoGETAPI("Report", "getMoveByUser");
    break;
}

To add an API endpoint:

  • Core Boxx has an API structure of http://site.com/api/MODULE/REQUEST.
  • lib/API-report.php will create an API endpoint at http://site.com/api/report.
  • $_REQ is the requested service REQUEST segment of the URL.

So for this example, we can send $_POST["id"] = 123 to http://site.com/report/getMoveByUser/ to get the movement report. The API will reply with a JSON encoded string.

 

STEP 4) ADD/UPDATE HTML CSS JAVASCRIPT

  • Add your new pages in pages/.
    • For example, pages/PAGE-report.php can be accessed from http://site.com/report.
    • Take note – PAGE-report.php can only be accessed by users who are signed in.

That’s about it. Just reverse engineer and copy from the existing libraries, API, and pages… You will see the development pattern here.

30 thoughts on “Storage Boxx PHP Inventory System (With QR & NFC Scanner)”

  1. We should be able to download a database and the files so we can simply upload them to our server 🙂 and connect. Can you provide a database and the files? 🙂 I have fought for two days, and my server won’t do it.

    1. No idea what you are trying to do here… There’s already an automated installer? All the source files are available for download here and on GitHub? If you want to manually install, see “MANUAL INSTALLATION” above.

      P.S. If you have zero experience, I will highly suggest you start with the raw basics or hire your own web developer. Good luck.

    1. EDIT – Whoever encounters the same problem in the future, it’s either:

      1) MOD_REWRITE is enabled, but AllowOverride is not properly set.
      2) SSL issues. Apache is not serving the pages and/or static assets properly.

      Will try to add more checks, but fingers crossed. PHP has limited or no access to these Apache settings.

Leave a Comment

Your email address will not be published. Required fields are marked *