Download the PHP package rmitesh/laravel-pantry without Composer

On this page you can find all versions of the php package rmitesh/laravel-pantry. 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 laravel-pantry

Laravel Pantry

You may know and worked with repository pattern in the Laravel.

Now, here I am going to introduce Laravel Pantry where you get all things in one place same as Food Pantry Shop.

laravel-pantry

Latest Stable Version Total Downloads Laravel v10.x PHP 8.1

Installation

You can install the package via composer:

Create a new Pantry

To create a new Pantry class

Based on the Pantry class name, automatically consider model name will be same as Pantry class.

Or you want to generate for specific model.

It will create FoodPantry class inside the app/Pantries directory. and Food is model class name.

So, final directory structure will look like this.

How to use

In your FoodController add __construct function.

OR

Available Methods

get()

To fetch single record.

Argument Value
$record It accepts model ID ( Illuminate\Database\Eloquent\Model, string, id )
$columns Column names in array format, by default it will be ['*']
$relationships It's Optional, You can pass relationship arguments in array. see relationships examples

It will also works with Route Model Binding.

It will return eloquent class on record found, else it will throw 404 | Not found.

getAll()

To fetch multiple records.

With conditions, it's an optional parameter.

With relationships, it's an optional parameter. More details, check Fetch data with relationships.

Argument Value
$columns Column names in array format, by default it will be ['*']
$conditions It's Optional, You can add conditions, by default it will be empty array.
$relationships It's Optional, You can pass relationship arguments in array. see relationships examples

As a return it will give collection.

paginate()

To fetch records with pagination.

To use paginate() method, you have to use Rmitesh\LaravelPantry\Pantries\Concerns\HasPagination.

For change per page records limit, you can override the $perPageRecordLenght in your Pantry class.

By default $perPageRecordLenght value set is 20 and that is enough for per page records.

Or with relationships

As a return it will give Illuminate\Pagination\LengthAwarePaginator collection.

store()

To store data in table.

You need to just pass the array data.

Argument Value
$data Array key-value pair

As a return it will give created model instance.

update()

To update data in table.

Argument Value
$key It accepts record ID ( Illuminate\Database\Eloquent\Model, string, id )
$data Array key-value pair

As a return it will give updated model instance.

destroy()

To delete single record.

Argument Value
$key It accepts record ID ( Illuminate\Database\Eloquent\Model, string, id )

As a return true on record deleted, false on failure.

destroyAll()

To delete multiple records at once.

Argument Value
$ids It accepts record ID in array or Illuminate\Support\Collection format

As a return true on record deleted, false on failure.

Fetch data with relationships.

To add relationships, you can pass in array format.

Let's take an example, One Food has many ingredients. So, to fetch Food records along with their Ingredients.

For relationships, as key it should be relationship name like with, withWhereHas, whereHas, withCount, whereBelongsTo and so on.

Moreover, if you want to add Closure function then

Or if you have multiple relationships then,

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Buy me a Coffee

Buy Me A Coffee

Credits

License

The MIT License (MIT). Please see License File for more information.


All versions of laravel-pantry with dependencies

PHP Build Version
Package Version
No informations.
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 rmitesh/laravel-pantry contains the following files

Loading the files please wait ....