All Tutorials & Sample Codes

Browse all our Laravel 12, CodeIgniter 4, and PHP tutorials. Each guide includes working source code, best practices, and step-by-step instructions.

Showing 55–60 of 79 posts · Page 10 of 14

How to Implement Role-Based Authentication in Laravel 11 with Custom Middleware

In Laravel 11, you can easily restrict access to routes and features based on user roles without setting up multiple authentication guards. This approach uses a single <span class="highlight">web</span> guard and a custom middleware to check a <span class="highlight">role</span> column.<br> It's ideal for apps needing simple user tiers (e.g., user, editor, admin) and avoids the complexity of multi-guard setups (separate logins/tables). For advanced RBAC, consider packages like Spatie Laravel-Permission.

By Revathi M · Read

How to Implement Google Login in PHP Using OAuth 2.0 (Step-by-Step Guide)

&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Adding <b>Google Login</b> (also called "Sign in with Google") to your PHP app is one of the easiest ways to provide secure, fast authentication. Users don't need to create new accounts—they simply use their existing Google credentials. This reduces friction, boosts conversions, and leverages Google's robust security. <br> In this updated tutorial, we'll use the official <b>Google API Client Library for PHP</b> to implement server-side Google OAuth 2.0 authentication. No database is required—we'll store basic user info in PHP sessions for simplicity.

By Revathi M · Read

Facebook Login in CodeIgniter 4: Complete Step-by-Step Tutorial (Using Graph SDK & OAuth 2.0)

&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;In today's web applications, <b>social login</b> options like <b>Facebook login</b> improve user experience by eliminating the need for separate registrations. This <b>CodeIgniter 4 Facebook login tutorial</b> shows you how to integrate <b>Facebook OAuth 2.0 authentication</b> using the official <b>Facebook Graph SDK</b> via Composer. Users can log in securely, and you'll retrieve basic profile data (ID, name, email) to store in session or database.

By Revathi M · Read

Implement Google Login (OAuth 2.0) in CodeIgniter 4 – Complete Tutorial with Example Code

&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Adding Google Sign-In to your CodeIgniter 4 application improves user experience, boosts conversion rates, and enhances security by leveraging Google's authentication. This step-by-step guide shows you how to integrate Google OAuth login using the official Google API Client library — no third-party packages needed beyond Composer.

By Revathi M · Read