Storage Boxx – Simple PHP Inventory System (Free Download)

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

 

TABLE OF CONTENTS

Download & Notes How To Use Quick Reference
How To Develop Common Problems

 

 

DOWNLOAD & NOTES

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

Cadre 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

Storage Boxx has not been extensively tested, but it is developed and works on a WAMP8 (Windows Apache MySQL PHP 8) server.

 

INSTALLATION

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

 

FEATURES

  • Manage users – Add/update/suspend.
  • Manage items – Add, update, and track stock movement.
  • Stock level monitoring.
  • CSV reports.
  • Progressive web app.
  • Push notifications.

 

 

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 INVENTORY ITEMS

  • Inventory > Items > Click on “+”.
  • Register your item.
  • Print out the QR code if you want – It does speed things up and makes things easier to manage. Get yourself a USB barcode scanner if you do not already have one. A simple one only costs like… 30~40 bucks these days.
  • Rinse and repeat, register all your items (or do some mass import from CSV magic into the database on your own).

 

STEP 2) UPDATE STOCK LEVELS

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

 

 

STEP 3) CHECKING STOCK LEVELS

To check an item, simply type in the SKU or scan the QR code.

 

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.

 

 

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.

 

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.

 

 

COMMON PROBLEMS & FIXING THEM

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

 

I FORGOT THE PASSWORD OR DELETED ALL ADMIN ACCOUNTS

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

Just create an “account recovery” script to create a new account (or update an existing one). Run and delete this afterward.

 

CHANGED DOMAIN OR NOT RESOLVING PROPERLY

  • 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/
  • Create an “update script”, run it, and delete it afterward.
    • require "lib/CORE-Go.php";
    • $_CORE->Route->htaccess();
    • This will automatically regenerate the .htaccess file.
  • Clear the browser cache to prevent irritating cache redirects.
  • Also, clear the service worker and cache storage if you want to be “totally safe”.

 

MANUAL INSTALLATION

  • Create a database and import all lib/SQL-*.sql.
  • 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.
    • Generate your own JWT secret key, and set the issuer to your domain or company name.
  • Run $_CORE->Route->htaccess() to create .htaccess.
  • Create your own admin user. See “forgot password” above.
  • Update index.php.
    • require __DIR__ . DIRECTORY_SEPARATOR . "lib" . DIRECTORY_SEPARATOR . "CORE-Go.php";
    • $_CORE->load("Route");
    • $_CORE->Route->run();

 

NOT WORKING. DON’T KNOW WHY.

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

How To Debug Javascript – A Very Simple Guide

How to Debug PHP Code – A Very Simple Guide

 

28 thoughts on “Storage Boxx – Simple PHP Inventory System (Free Download)”

  1. Hi, It’s working fine but i’m facing a little problem while tracking the inventory. Whenever i update the current stock it shows Date and time. The problem I’m facing is that , I’m living in India and the tracking time doesn’t match with IST [ Indian Standard Time] ie.. GMT +5:30 hours. Is their any way of getting it correct, yes then it would be really helpful for me.
    Thanks.

      1. Hi, thanks for the reply, it worked, but i also found 1 more problem is that when we log out it shows – ” AJAX ERROR Failed to parse JSON data.” on first time and it will logged out on second time.

      2. Thanks for reporting! But “AJAX error” is too generic – Open the developer’s console and see what the server is complaining about. Good luck.

  2. Jeroen van der Steen

    I’m a small printshop owner from Rotterdam, the Netherlands
    and I would like to keep track of my paper and office supplies.

    Recently I discovered Storage Boxx and it really looks simple to use,
    and efficient for working with by scanning QR-codes.
    Is it possible to add extra fields for Items, like ‘price’ or ‘product-image’.

    I also tried making by own stock management system in PHP,
    but it’s not efficient to work with.

  3. Hi there,
    I have checked and debugged as best i can but i am not seeing what the problem is.
    I have also made sure that PHP 7.4 is installed. I am getting the following error when installing:
    Fatal error: Uncaught Error: Call to undefined function apache_get_version() in /home/ccmuhahx/public_html/ua/lib/CORE-install.php:72 Stack trace: #0 /home/ccmuhahx/public_html/ua/index.php(2): require() #1 {main} thrown in /home/ccmuhahx/public_html/ua/lib/CORE-install.php on line 72

    any assistance would be greatly appreciated
    Garth

    1. undefined function apache_get_version() > PHP is not installed as a module of Apache

      Installer updated. Nothing is wrong if you are running Apache. It’s just running in another manner. Follow up with an “apache cgi vs module” search on the Internet if you wish to learn more.

      1. Thank you, however the new installer is throwing the following error:
        Fatal error: Uncaught Error: Call to undefined function str_contains() in E:\Software\wamp\www\php\Storage-Boxx-2022-05-05-a\lib\CORE-install.php on line 72
        Error: Call to undefined function str_contains() in E:\Software\wamp\www\php\Storage-Boxx-2022-05-05-a\lib\CORE-install.php on line 72

        Regards
        Garth

      2. Of course. str_contains() only exists in PHP 8+.

        1) Updated installer to use strpos instead.
        2) Required PHP version has been updated to 8.0. Reason – PHP 7.4 will come to its end of life in Nov 2022. A gentle reminder to update your server soon. https://www.php.net/supported-versions.php
        3) If you still want to continue with 7.4, edit lib/CORE-install.php C1 – change I_MIN_PHP back to 7.4.0

  4. Hi there, works perfectly. Only problem is, it does not scan any barcode or QR code.
    Error always says: Invalid SKU

    Any ideas?
    Thanks
    Garth

  5. Hi W.S. TOH,

    I succeeded.
    Thank you for your patience and please allow me to continue learning with your help.
    projects seem to me the best way to really learn!
    all good,

  6. Hi W.S.TOH,
    I almost managed, that is, after “installation”, at the primary login with user: “admin@sb.com” and the password “123456”, click on “Sign in” and the “AJAX ERROR” window appears.
    “AJAX call error!”
    What should I investigate?

    1. Probably API path issues, re-download the latest version. Just import the SQL, and access your site – This thing now has a simple installer… and a webcam QR code scanner.

      1. ok, i tried and got stuck in the “installer” where I got the “Fetch error – See console” error, but I noticed two things:
        1. This error occurs regardless of what user and password you entered to access the database
        2. The file “lib / storage-boxx.sql” is empty, ie it has only a command line “ctrl – C – exit!” and nothing about the tables on which the database is built
        …help me please !

  7. Hi, I installed in base path and can’t get past login screen. It seems to be dropping me at “(B4) USERS NOT LOGGED IN + INVALID PATH”

    What do you think is the problem?

Leave a Comment

Your email address will not be published.