Download the PHP package aldeebhasan/naive-crud without Composer

On this page you can find all versions of the php package aldeebhasan/naive-crud. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package naive-crud

Laravel Naive Crud

A lightweight package handle laravel api crud operations

Installation

Install using composer:

Optional: After installation run the following code to publish the config:

Basic Usage

This package will help yo to fully customize your crud and have a huge control over each part of your development> No more duplicated code will appear.

Project structure

The best way to understand how the package works is by examples, lets suppose that we want to create a crud for Blogs

Assume that we have a model for blog as App\Models\Blog.php

Controller:

Query handling:

We can control the access to data that need to be returned or exported using a list of re-defined query helpers

Routes:

We have two routes group

Authorization:

Authorization to access controller resource can be controller using authorize param, by default it is True

We expect the user has a defined gates of the following form: action_resource,

In our example, if we want the user to have access to the index route, he should have the following ability:

Most of the rules and permissions pacjages define this policies for us based on the user assigned permissions

Resources

By default the package will search for a resource that match the model name. In our example, the package will look for BlogResource under namespace App\\Http\\Resources. If not found, it will return the $model->toArray() as response to all the retrieve model routes

Request Forms

By default the package will search for a request form that match the model name. In our example, the package will look for BlogRequest under namespace App\\Http\\Requests. If not found, it will use a default request class with no rules to control the received data

Filters

We can define a list of filters for each controller to filter the returned data based on some query parameters sent with the api request

When we call the index endpoint .../api/blogs we can pass the filters as follow .../api/blogs?filters[search]=title&filters[category_id]=1 and it will filter the results according to them. You can group the filter fields as you want in any filter class, and you can use any number of filter class as you want

Sorters

Similar to Filters, we can define some field to order the returned data as we want as follow:

When we call the index endpoint .../api/blogs we can pass the sorters as follow .../api/blogs?sorts[id]=desc&filters[tag]=asc and it will order the results according to the sorters. You can group the sorter fields as you want in any sorter class, and you can use any number of sorter class as you want

Bulk Operations

In general, the bulk operations use the rules defined for store/update, if you want you can override bulkStoreRules to add some more rules

Sample request for bulk store:

Export & Import

Simply, you can import the data from an external file. First you need to download the sample template file useing .../api/blogs/import-template Then, after you fill some date, you can import it by sending the following request:

NOTE: we expect the file to be uploaded and accessible through the provided file path, Also all the import operation are imported chunk by chunk using the queue

On the other hand, to export any data you can use:

For the case of huge amount of data need to be exported, you can send the export operation to be handled by the queue later. This operation can be controller by changing $exportAllShouldQueue in your controller to be `True.

By doing this, a notification will be send to the current user

Important: when you set exportAllShouldQueue=True, you have to define the notification class that will be used to inform the current user

[!IMPORTANT] To enable any model to be imported and exported it should implement the ExcelUI Interface

License

Laravel Naive Crud package is licensed under The MIT License (MIT).

Security contact information

To report a security vulnerability, contact directly to the developer contact email Here.


All versions of naive-crud with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
intervention/image Version ^3.6.2
maatwebsite/excel Version ^3.1
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package aldeebhasan/naive-crud contains the following files

Loading the files please wait ....