Skip to content

AmigoPHP is a lightweight PHP framework for building web applications. With AmigoPHP, you can create dynamic and responsive websites easily. Get started now by exploring our documentation or creating your first AmigoPHP project.

Notifications You must be signed in to change notification settings

AmigoDheena/AmigoPHP

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AmigoPHP Documentation

Welcome to the documentation for AmigoPHP - a lightweight PHP framework for building web applications.

Table of Contents

  1. Introduction
  2. Installation
  3. Routing
  4. Views
  5. Controllers
  6. Models
  7. Database
  8. Middleware
  9. Validation
  10. Error Handling
  11. Security
  12. Configuration
  13. Getting Started

1. Introduction

AmigoPHP is designed to provide developers with a simple yet powerful tool for building web applications in PHP. It follows the MVC (Model-View-Controller) architectural pattern, making it easy to separate concerns and maintain code.

2. Installation

To install AmigoPHP, simply download the framework files and place them in your project directory. You can then include the necessary files in your PHP scripts to start using the framework.

3. Routing

AmigoPHP provides a flexible routing system that allows you to define routes for different URLs and map them to specific controllers and actions.

Example:

    // Define a route for the home page
    Route::get('/', 'HomeController@index');

    // Define a route with parameters
    Route::get('/users/{id}', 'UserController@show');

4. Views

Views in AmigoPHP are typically written using Blade-like syntax, allowing you to easily incorporate dynamic content into your HTML templates.

Example:

    // Render a view with data
    return view('home', ['name' => 'John Doe']);

5. Controllers

Controllers in AmigoPHP handle the logic of your application. They receive requests from routes, process data, and return responses to the client.

Example:

    class HomeController extends Controller
    {
        public function index()
        {
            return view('home');
        }
    }

6. Models

Models in AmigoPHP represent data structures and interact with the database. They encapsulate the business logic of your application and provide an interface for querying and manipulating data.

Example:

    class User extends Model
    {
        // Define table name
        protected $table = 'users';
    
        // Define relationships, queries, etc.
    }

7. Database

AmigoPHP provides a simple database abstraction layer for interacting with databases. You can define database connections and perform CRUD operations using intuitive methods.

Example:

    // Retrieve all users from the database
    $users = DB::table('users')->get();

8. Middleware

Middleware in AmigoPHP allow you to filter HTTP requests before they reach your application's routes or controllers. You can use middleware to perform authentication, authorization, and other tasks.

Example:

    class AuthenticateMiddleware
    {
        public function handle($request, $next)
        {
            // Check if user is authenticated
            if (!Auth::check()) {
                // Redirect to login page
                return redirect('/login');
            }
    
            // Continue with request
            return $next($request);
        }
    }

9. Validation

AmigoPHP provides a validation library for validating incoming request data. You can define validation rules and messages for your application's forms and ensure data integrity.

Example:

    // Validate form input
    $request->validate([
        'name' => 'required',
        'email' => 'required|email',
    ]);

10. Error Handling

AmigoPHP includes robust error handling capabilities to help you identify and debug issues in your application. You can customize error pages and log errors for analysis.

11. Security

Security is a top priority in AmigoPHP. The framework includes built-in features for protecting against common security threats, such as CSRF (Cross-Site Request Forgery) attacks, SQL injection, and XSS (Cross-Site Scripting) vulnerabilities.

12. Configuration

AmigoPHP allows you to configure various aspects of your application, such as database connections, caching, session management, and more. Configuration files are easy to manage and can be customized to suit your needs.

About

AmigoPHP is a lightweight PHP framework for building web applications. With AmigoPHP, you can create dynamic and responsive websites easily. Get started now by exploring our documentation or creating your first AmigoPHP project.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published