A PHP-based personal book lending management system following SOLID principles, clean architecture, and test-driven development with multi-tenant user isolation.
- Multi-tenant Architecture: Each user's data is completely isolated
- Social Authentication: Login via Google, Facebook, or Microsoft
- Book Management: Add books manually or via Open Library API
- Lending Tracking: Track who has borrowed your books
- Responsive Design: Works on desktop, tablet, and mobile devices
- Secure: Built with security best practices and SOLID principles
- Backend: PHP 8.2+ with Laravel 10
- Database: MySQL 8.0 with multi-tenant architecture
- Frontend: Blade templates + Tailwind CSS
- Authentication: Laravel Socialite
- Testing: PHPUnit
- Development: Docker Compose
- Docker and Docker Compose installed
- Git
- Clone the repository:
git clone <repository-url>
cd rentBook- Copy environment file:
cp .env.example .env- Start Docker containers:
docker-compose up -d- Install dependencies:
docker-compose exec app composer install
docker-compose exec app npm install- Generate application key:
docker-compose exec app php artisan key:generate- Run migrations:
docker-compose exec app php artisan migrate- Link storage:
docker-compose exec app php artisan storage:link- Build assets:
docker-compose exec app npm run build- Application: http://localhost:8080
- phpMyAdmin: http://localhost:8081
- Database: localhost:3306
-
Create OAuth apps at:
- Google: https://console.cloud.google.com/
- Facebook: https://developers.facebook.com/
- Microsoft: https://portal.azure.com/
-
Update
.envfile with your credentials:
GOOGLE_CLIENT_ID=your_google_client_id
GOOGLE_CLIENT_SECRET=your_google_client_secret# Run all tests
docker-compose exec app php artisan test
# Run specific test
docker-compose exec app php artisan test --filter AuthenticationTest
# Generate coverage report
docker-compose exec app php artisan test --coverage# Fix code style
docker-compose exec app ./vendor/bin/php-cs-fixer fix
# Run static analysis
docker-compose exec app ./vendor/bin/phpstan analyseThe application follows Clean Architecture principles:
- Presentation Layer: Controllers, Views, Routes
- Application Layer: Use Cases, Services
- Domain Layer: Entities, Repositories Interfaces
- Infrastructure Layer: Database, External APIs
- Row-level security with
tenant_idcolumns - Global scopes in Laravel models for automatic filtering
- Middleware to set current tenant context
- Cross-tenant data access prevention
- Unit Tests: Individual classes and methods
- Feature Tests: User workflows and scenarios
- Integration Tests: API integrations and database operations
- Minimum 80% code coverage required
Use Docker Compose for local development.
- Push code to Git repository
- Configure cPanel Git deployment
- Set environment variables
- Run
composer install --optimize-autoloader --no-dev - Run
php artisan config:cache - Run
php artisan migrate --force
- Follow PSR-12 coding standards
- Write tests for new features
- Ensure all tests pass before submitting
- Follow SOLID principles and clean architecture
This project is open-source software licensed under the MIT license.