A Laravel and MySQL library app with a public book catalog, administrator tools, member accounts, circulation, and fine tracking. The interface uses Blade, HTML, CSS, and a small amount of JavaScript.
- PHP 8.2 or newer with the PDO MySQL extension enabled
- Composer
- MySQL or MariaDB (XAMPP includes MariaDB)
- Node.js and npm for compiling the frontend assets
This repository currently uses Laravel 12. Check composer.json before changing framework or PHP versions.
-
Start MySQL from the XAMPP Control Panel and create a database named
library_management_systemin phpMyAdmin. -
If this is a fresh checkout, copy
.env.exampleto.env. If.envalready exists, keep it and update its database settings instead of overwriting it. -
Set
DB_CONNECTION=mysql,DB_HOST=127.0.0.1,DB_PORT=3306,DB_DATABASE=library_management_system,DB_USERNAME=root, and the local MySQL password in.env. -
Install dependencies and initialize the app:
composer install php artisan key:generate php artisan migrate --seed php artisan storage:link npm install npm run build php artisan serve -
Open
http://127.0.0.1:8000to browse the catalog. For frontend changes, runnpm run devin a second terminal while the Laravel server is running.
Never copy real credentials into .env.example or commit .env to a public repository.
The database seeder creates sample accounts for local development:
| Role | Password | |
|---|---|---|
| Administrator | admin@library.test |
ChangeMe123! |
| Member | amina@example.test |
Reader123! |
| Member | kavindu@example.test |
Reader123! |
| Member | nimali@example.test |
Reader123! |
Set LIBRARY_ADMIN_EMAIL and LIBRARY_ADMIN_PASSWORD in .env to choose local administrator credentials. If the password is blank, the seeder uses the documented local demo password. These demo credentials are for local development only; set a unique password before using a non-local environment. .env.example contains no real credentials.
- Public catalog search by title, author, ISBN, and category, with availability filters.
- Administrator dashboard, book and physical-copy management, member accounts, loans, returns, and fine-payment history.
- Member pages showing that member’s active and past loans, due dates, and fine balances.
- Server-side role checks, form validation, CSRF-protected write routes, and hashed passwords.
- Stock changes and loan creation inside database transactions.
- Books are archived instead of deleted, so their loan history remains available.
Defaults are in config/library.php and can be overridden in .env:
- Maximum active loans per member: 3 (
LIBRARY_BORROWING_LIMIT) - Standard loan duration: 14 days (
LIBRARY_LOAN_DURATION_DAYS) - Daily overdue fine: LKR 50.00 (
LIBRARY_FINE_RATE_PER_DAY) - Currency display: LKR (
LIBRARY_CURRENCY)
Each physical copy has a unique barcode and availability status. The loan stores the daily fine rate that applied when it was issued. The due date itself is not late; an overdue fine counts calendar days after that date. Active loans show an estimate, and the fine amount is finalized on return. Payments are stored as separate records and reduce the unpaid balance without erasing history.
Run the automated checks with:
php artisan testThe suite uses an in-memory SQLite database and covers role restrictions and member data privacy, member/book creation, catalog archiving, checkout limits and stock changes, duplicate checkout/payment submissions, returns, date validation, overdue fine calculation, and payment balances. The application itself is configured for MySQL/MariaDB in .env.example.
- Sign in with the seeded administrator account and add a book with at least one copy barcode.
- Create a member, then issue the book and show the available-copy count decrease.
- Record the return after its due date and show the calculated fine in the fine register.
- Record a partial fine payment and show it in payment history with the remaining balance.
- Sign in as that member and show only their own loan history and fine balance; try an admin URL to demonstrate that it is denied.
- Archive the book and confirm it disappears from the public catalog while its loan history remains.
usersstores administrator and member accounts, including membership number, role, contact number, and active status.booksstores title-level catalog information; authors and categories are separate related records.book_copiesstores each physical copy and its barcode.loansconnects a member to one physical copy and records issue, due, return, and fine details.fine_paymentsstores payment amount, date, receiving administrator, and optional note.
Online reservations, online payment gateways, barcode hardware, messaging, multi-branch support, and third-party integrations are not part of this version.