A Full CRUD API using Laravel V.12 along with Sanctum for authentication
- Design Pattern: Follows the Repository Pattern for data access.
- RESTful Architecture: Follows standard REST principles for API design.
- Authentication: Basic setup for API authentication (e.g., Sanctum or Passport - specify if implemented).
- API Resources: Transforming models into JSON responses.
- CRUD Operations: Example endpoints for Create, Read, Update, Delete operations on resources.
- Request Validation: Input validation to ensure data integrity.
- Error Handling: Consistent error responses.
- PHP (version specified in
composer.json
>= 8.1) - Composer
- A database supported by Laravel (e.g., MySQL, PostgreSQL, SQLite)
-
Clone the repository:
git clone https://github.com/Pog-Frog/Laravel-RESTful-APIs.git cd Laravel-RESTful-APIs
-
Install PHP Dependencies:
composer install
-
Environment Setup:
- Copy the example environment file:
cp .env.example .env
- Generate the application key:
php artisan key:generate
- Configure your database connection and other environment variables in the
.env
file (DB_HOST, DB_PORT, DB_DATABASE, DB_USERNAME, DB_PASSWORD, etc.).
- Copy the example environment file:
-
Database Migrations:
- Run the database migrations to create the necessary tables:
php artisan migrate
- (Optional) Seed the database with initial data:
php artisan db:seed
- Run the database migrations to create the necessary tables:
-
Development Server: Start the local development server:
php artisan serve
The API will typically be available at
http://127.0.0.1:8000
orhttp://localhost:8000
. -
API Endpoints: Refer to the API documentation or route definitions (
routes/api.php
) for available endpoints.