Git Product home page Git Product logo

laravel-api-scaffold's Introduction

Laravel API Scaffold

Welcome to the Laravel API Scaffold, a streamlined solution for establishing a consistent API structure within your Laravel application.

Installation

Begin by installing the package via Composer:

composer create-project --prefer-dist redot/laravel-api-scaffold

And voila! You're all set to proceed.

What's Included

Our package provides essential components to kickstart your API development:

Features

Experience the following features tailored for your convenience:

  • Robust authentication system supporting multiple guards for admins and users.
  • Integration of a settings model for seamless application settings management.
  • Handpicked utilities to expedite your development journey.

Directory Structure

We strive to maintain Laravel's default directory structure with some enhancements.

Routes

As an API scaffold, we've made adjustments to the routes structure:

  • dashboard.php: Houses dashboard routes, prefixed with /dashboard.
  • website.php: Contains public website routes without any prefix.

Controllers

Controllers are organized into two distinct directories:

  • Dashboard: Dedicated to dashboard-related controllers.
  • Website: Hosts controllers pertinent to the public website.

Each directory features a Controller class extending Laravel's default Controller, with additional functionalities.

respond Method

Easily handle action success responses with the respond method, supporting named parameters in PHP 8.

public function index()
{
    return $this->respond(
        payload: ['foo' => 'bar'],
        message: 'This is a message',
        status: 200
    );
}

fail Method

Effortlessly manage action failure responses using the fail method.

public function index()
{
    return $this->fail(
        message: 'This is a message',
        status: 400,
        payload: ['foo' => 'bar']
    );
}

Requests

Similarly, requests are categorized into Dashboard and Website directories for clarity.

Utilities

Benefit from our bundled utilities designed to simplify your workflow.

CanUploadFile Trait

This trait facilitates file uploading within your application, offering methods like uploadFile and deleteFile.

FirebaseNotify Trait

Streamline user notifications via Firebase Cloud Messaging with the notify method.

Setting Model

The Setting model is your go-to solution for storing application settings, accessible via the get method or setting helper function.

// Access settings using the model
Setting::get('foo');

// Or via the helper function
setting('foo');

Enjoy seamless performance with automated settings caching.


Embrace Laravel API development with ease, thanks to our intuitive scaffold. Happy coding!

laravel-api-scaffold's People

Contributors

abdelrhmansaid avatar

Stargazers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.