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

Storage Boxx is an open-source PHP Inventory Management System. With a built-in webcam QR scanner, NFC scanner, passwordless login, and an optional experimental AI assistant.

 

TABLE OF CONTENTS

 

DOWNLOAD & INSTALLATION

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

 

LICENSE & DOWNLOAD

GitHub | GitHub – AI Assistant | SourceForge

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.

 

SORRY FOR THE ADS...

But someone has to pay the bills, and sponsors are paying for it. I insist on not turning Code Boxx into a "paid scripts" business, and I don't "block people with Adblock". Every little bit of support helps.

Buy Me A Coffee Code Boxx eBooks

 

SYSTEM REQUIREMENTS

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

 

 

INSTALLATION

Just copy/unzip into your HTTP folder. Access http://your-site.com in the browser and walk through the installer.

 

HOW TO USE

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

 

EQUIPMENT RECOMMENDATIONS

  • Webcam – If you are using a desktop without a webcam, a simple one only costs about $20~30.
  • USB QR Code scanner – Alternatively, a “dedicated barcode scanner” will cost about $30~40 bucks.
  • NFC tags – 10 pieces of Ntag213 only cost 2-3 bucks. Buy them in bulk, and one piece will only cost a few cents.
  • Fingerprint sensors – These are kind of expensive… But I got lucky with a $25 “Made in China” that works just fine.
  • Label printer – Print your QR codes. There are Bluetooth ones that can pair with smartphones.

 

PART 1) REGISTER ITEMS

First step, register all your items. You can do it one by one, or the smarter way is to upload a CSV file if you have a lot of products.

 

PART 2) REGISTER BATCHES

Now that the items are in place, create the batches for every item.

  • Batches are particularly good for managing items with expiry dates, or if you want to track how slow/fast a batch moves.
  • For the people who don’t care about “batches” – Just create a dummy batch and use it for a lifetime.
  • Print the QR code for the batches, and/or create the NFC tags.

 

 

PART 3) ITEM MOVEMENT

Record the item/batch movement accordingly over time. Pretty self-explanatory.

  • Set the direction (in, out, discard, stock take).
  • Set the quantity.
  • Add notes, if any.
  • Enter the SKU and batch – Or just scan.

 

PART 4) CHECK

You can access the “check” section at any time, check the stock movement history.

 

EXTRA) PASSWORDLESS SIGN IN

The days of stinky passwords are over.

  • You can create NFC login tags (staff card) for users. So long as they have a compatible device/browser, they can use it to login without entering the user/password.
  • Alternatively, open the user menu after you have signed in (top-right corner) – Passwordless Login. Register to sign in with your fingerprint, face recognition, or pin number.

 

 

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", "A");

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

 

CHANGED DOMAIN OR PATH

  • Update SITE_NAME and HOST_BASE in lib/CORE-Config.php. 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 .htaccess and update CB-manifest.json.
  • Delete init.php.
  • Clear the service worker, flush the browser cache, and do a hard reload 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-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>

 

 

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

 

UNABLE TO GENERATE JSON WEB TOKEN KEYS

Make sure that the OpenSSL extension is properly installed.

  • Linux
    • It is as simple as sudo apt-get install openssl.
    • Or yum install openssl for the CentOS users.
    • Then, php -i | grep -i openssl.
  • Windows – I am using XAMPP and OpenSSL is already included. But a hiccup got me stumped for a while.
    • Start > Search for “system environment” > “Edit the system environment variables” > “Environment variables”.
    • Add a new system variable called OPENSSL_CONF and point it to the openssl.cnf file. By default, it is located at xampp\php\extras\openssl\openssl.cnf.

 

 

FOR THE DEVELOPERS

This section is for the developers, with a couple of development notes for customization.

 

BUILT ON CORE BOXX

 

SUPPORTING MULTIPLE HOST/DOMAIN NAMES

  • In CORE-Config.php, detect the origin and set HOST_BASE accordingly.
  • If you have different paths, you are going to face problems with the manifest. E.G. https://sitea.com and https://siteb.com/storageboxx.
    • You can create multiple CB-manifest.json, each with a different start_url and scope. In TEMPLATE-top.php, point to the “correct manifest” accordingly.
    • Alternatively, generate the manifest dynamically using PHP.

 

SETTING TIMEZONES

  • You can change the default timezone in CORE-Config.php, SYS_TZ and SYS_TZ_OFFSET. Beware though, this can mess up the timestamps in the database if you already have entries.
  • If you have to support multiple timezones, it will be wise to keep the system default to UTC. Calculate the offset in PHP or MYSQL queries instead.

 

 

I WANT TO CHANGE THE DATE FORMAT

  • Login > System Settings > There are 4 “MYSQL date/time format” settings, change them accordingly. These are simply formats for the MYSQL DATE_FORMAT() function.
  • Use the respective date/time format in your SQL – "SELECT DATE_FORMAT(`col`, '".DT_LONG."') FROM `table`".

 

EXPIRING ITEMS NOTIFICATION

Tricky.

  • Create a expire-notify.php script, set it to run every 24 hours in Windows Task Scheduler or CRON.
  • Add a EXPIRE_WARN_DAYS setting.
  • Modify $_CORE->Report->getExpiry() to get expiring items with EXPIRE DAYS > 0 && EXPIRE DAYS <= EXPIRE_WARN_DAYS.
  • If there are expiring items, send the notification.
  • It will be wise to add another EXPIRE_NOTIFIED table to keep the item_id and batch_name… Or the system will nag every 24 hours until the item expires.

 

AI ASSISTANT

So, you may have noticed that the AI Assistant is “missing” or “not working” out of the box. It’s a long story.

 

 

REQUIREMENTS

  • Python – Yes, Python. Not PHP. Version 3.9 to 3.10 seems to work fine at the time of writing.
  • Microsoft C++ Build Tools
  • CMake
  • Nvidia CUDA Toolkit – If you have an Nvidia graphics card.
  • An Nvidia graphics card with at least 8GB VRAM is highly recommended. You can TRY to run on CPU, but it is painfully slow and practically useless.

 

INSTALLATION

  • Copy/unzip this module into your existing Storage Boxx folder.
  • I have tried multiple AI models, codellama-7b-instruct.Q5_K_M.gguf is the only one that produced decent(ish) results – Download that into chatbot/models or choose a better/larger/smarter model on your own.
  • Edit chatbot/a_settings.py, change the model_name to your own.
  • BE WARNED, GIGABYTES WORTH OF DOWNLOAD! – 0-setup.bat (Windows) 0-setup.sh (Linux).

 

LAUNCH

  • Run 1-bot.bat (Windows) 1-bot.sh (Linux/Mac), this will deploy the bot at http://your-site.com:8008.
  • Just access http://your-site.com/ai (must be signed in).

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

  1. Hello, I am getting following error:
    Fatal error: Uncaught RuntimeException: Unable to create the key in C:\xampp\htdocs\lib\webpush\web-token\jwt-core\Util\ECKey.php:98 Stack trace: #0 C:\xampp\htdocs\lib\webpush\web-token\jwt-core\Util\ECKey.php(72): Jose\Component\Core\Util\ECKey::createECKeyUsingOpenSSL(‘P-256’) #1 C:\xampp\htdocs\lib\webpush\web-token\jwt-key-mgmt\JWKFactory.php(69): Jose\Component\Core\Util\ECKey::createECKey(‘P-256’, Array) #2 C:\xampp\htdocs\lib\webpush\minishlink\web-push\src\VAPID.php(165): Jose\Component\KeyManagement\JWKFactory::createECKey(‘P-256’) #3 C:\xampp\htdocs\lib\CORE-Install.php(132): Minishlink\WebPush\VAPID::createVapidKeys() #4 C:\xampp\htdocs\index.php(2): require(‘C:\\xampp\\htdocs…’) #5 {main} thrown in C:\xampp\htdocs\lib\webpush\web-token\jwt-core\Util\ECKey.php on line 98

    Can you advice?
    Thank you
    XludodX

  2. I’m trying Storage Boxx on my hosted web server. It works, at least to show the config page. But when I hit “GO” button there is an error with:

    Unable to connect to database – SQLSTATE[HY000] [1045] Access denied for user ‘Sql635819_2’@’31.11.36.236’ (using password: YES)

    I think there something wrong in building the DB_USER name, but no result from searching the code base. In my opinion the problem depends from the fact that siet files are on a IF that’s different from MySql DB. My web server is: 31.11.36.236 and my mysql db is: 62.149.150.182. I’ve specified the ip for database server in the setup form.
    Please help me.
    Cheers
    Luigi Visintin

  3. 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 *