Download the PHP package mayankjanidev/laravel-store without Composer

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

Laravel Store

Create reusable database queries and data objects in Laravel.

Requirements

Installation

Install the package via Composer:

Purpose

Often, we have business critical data that we want to manage in a project. We might use them in controllers, services, console commands, admins, and other pieces of code. Laravel Store helps you centralize this critical data, so it's easy to manage and update it from time to time. This helps debug things faster and avoids query duplication scattered around the codebase.

Basic Usage

Create a store via the command line:

A store file will be created in App\Stores\TopRatedMovies.

You can also specify your own location, like for example in App\Data:

Store example:

You can now use this class anywhere in your codebase to fetch data. For example, in a controller:

This example uses dependency injection, but you can also manually instantiate the classes.

Congrats! Now you have one central place where you can customize the database queries, and you won't have to hunt down controllers to find it. But this is just the beginning, Laravel Store offers even more powerful features to manage data in your application.

Caching

Every store has its own methods to manage cache.

Get cached data:

Build cache:

Clear cache:

Customize Cache Settings

By default, cache duration is forever, and the cache key is calculated by the class name ('top-rated-movies' in this case). But you can customize it.

Manually specifying cache data

By default, all the data specified in the query() method will be cached by executing ->get() on the query. But you can cache a portion of the data.

Pagination

You can get the paginated data for your database queries.

This just calls the ->paginate() method on the query(), so it works the same as Laravel Pagination.

Custom Store

You might have some data in your application that is in a different format, like an array, and does not return a database query. In those cases, you can use a CustomStore where you can return data in your own format rather than being dependent on Laravel model and query builder.

Create a custom store via the command line:

All the caching methods work exactly the same as in QueryStore.

Cache Commands

If you manage your data via the command line or via Task Scheduling, Laravel Store provides cache specific commands:

Cache data:

Clear cache:

Use in Task Scheduling:

Advanced Usage

Invalidate cache when data is changed

You might want to invalidate the cache or rebuild it when the underlying data is changed. Combine this package with Laravel Observers to achieve the same.

Different variations of the same data

In some cases, you might want to show different variations of the same data. For example, in your API you would like to show a very small subset of data. As Laravel Store is just a class, you can add your own methods to it.

Dependency on other classes

In some cases, your data could be dependent on some other piece of data. In those cases, you could simply use constructors to inject it.

Laravel's Service Container can automatically resolve your dependencies.

License

This package is released under the MIT License.


All versions of laravel-store with dependencies

PHP Build Version
Package Version
Requires php Version ^8.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 mayankjanidev/laravel-store contains the following files

Loading the files please wait ....