A robust and secure login system built with Laravel, providing authentication, authorization, and user management features.
- User registration with email verification
- Secure login and logout functionality
- Password reset via email
- Session management
- Remember me functionality
- Social media login integration (optional)
- Two-factor authentication (optional)
- Role-based access control
- Account settings and profile management
- PHP >= 8.1
- Composer
- Node.js and npm
- MySQL, PostgreSQL, or SQLite
- Apache or Nginx web server
- Clone the repository:
git clone https://github.com/your-username/login-system.git
cd login-system- Install PHP dependencies:
composer install- Install Node.js dependencies:
npm install- Copy the environment file and set the configuration:
cp .env.example .env- Generate application key:
php artisan key:generate- Configure your database settings in the
.envfile:
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=your_database_name
DB_USERNAME=your_database_username
DB_PASSWORD=your_database_password- Run database migrations:
php artisan migrate- If you want to seed the database with sample data:
php artisan db:seed- Build the front-end assets:
npm run buildor for development with hot reloading:
npm run devAPP_NAME: The name of your applicationAPP_ENV: The application environment (local, production, etc.)APP_KEY: The application key (auto-generated)DB_*: Database configurationMAIL_*: Mail server configuration for password resetsCACHE_*: Cache driver configurationSESSION_*: Session configurationBROADCAST_*: Broadcasting configuration
For password reset functionality, configure your mail settings in .env:
MAIL_MAILER=smtp
MAIL_HOST=smtp.mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
MAIL_FROM_ADDRESS="hello@example.com"
MAIL_FROM_NAME="${APP_NAME}"php artisan serveThe application will be available at http://127.0.0.1:8000.
- Run tests:
php artisan testor./vendor/bin/phpunit - Clear cache:
php artisan cache:clear - Clear configuration cache:
php artisan config:clear - Clear route cache:
php artisan route:clear - Clear view cache:
php artisan view:clear - Generate application key:
php artisan key:generate - Run database migrations:
php artisan migrate - Rollback last migration:
php artisan migrate:rollback - Seed the database:
php artisan db:seed
The login system provides the following routes by default:
/login- Login page/register- Registration page/password/reset- Password reset request/password/reset/{token}- Password reset form/email/verify- Email verification notice/email/verify/{id}/{hash}- Email verification handler/logout- Logout route
- Always use HTTPS in production
- Sanitize all user inputs
- Use Laravel's built-in CSRF protection
- Implement rate limiting for login attempts
- Regularly update dependencies
- Use strong passwords and encourage users to do the same
- Implement proper session management
- Enable two-factor authentication for added security
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
Run the test suite using:
php artisan testTo run tests with coverage:
php artisan test --coverage- Upload project files to your server
- Run
composer install --no-devto install production dependencies only - Set proper file permissions
- Configure your web server (Apache/Nginx)
- Run migrations:
php artisan migrate --force - Clear caches:
php artisan config:clear,php artisan route:clear,php artisan view:clear - Set up scheduled tasks if needed (cron jobs)
If your login system includes API endpoints, document them here:
Most API endpoints require authentication using Laravel Sanctum or Passport. Include the token in your requests:
Authorization: Bearer {your-token-here}
POST /api/login- Authenticate userPOST /api/logout- Logout userPOST /api/register- Register new userGET /api/user- Get authenticated user details
This project is licensed under the MIT License.
If you encounter any issues, please open an issue on the GitHub repository or contact the project maintainers.
- Laravel Framework
- Composer
- Vite
- Bootstrap (or other CSS framework used)
- Font Awesome (if icons used)