Download the PHP package cyaoz94/laravel-utilities without Composer

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

Laravel Utilities

This is a package containing handy utils such as built-in authentication and authorization (Spatie Laravel Permissions), easy model filtering (Filtertable) setup, and easy CRUD API setup (CrudController).

Installation

Proceed to install the package via composer:

Usage

CrudController

You can extend our controller in order to use our base functions to speed up your CRUD api development. Just specify the model class in your constructor method and the CRUD methods defined in CrudController will know which model to query for.

Filterable

You can also use our Filterable trait so that you can easily implement filtering logic for your controller's CRUD methods.

First, use the trait in your model.

Define your filter class. Here we will define a name() method to handle filtering for the name column. Take note that the filter key should be always be in snake_case, eg. some_key. The QueryFilter.php class will loop through all the parameters in the request body to see if any matching method names in camelCase are found. Using back our some_key example, the matching function name will be someKey()

Then in your controller's constructor, specify which filter class to use. Now, name's value submitted in the request body will be used for filtering.

In certain scenarios, you will need to override the base functions of CrudController, you can still utilize the Filterable trait by doing the following

Migrations

The migrations of this package are now publishable under the "migrations" tag. It will publish the create_admin_users_table migration in the migrations folder in the database path, prefixed with the current date and time via:

Run the migrations to create admin_users table.

Spatie Laravel Permission

You can easily integrate spatie laravel permission using our package. You should publish the migration and the config/permission.php config file with:

Run the migrations to create all related tables.

You need to register our middleware in app/Http/Kernel.php file. If you would like to override our middleware, you can create your new middleware and extend ours. Remember to register your middleware in app/Http/Kernel.php.

You need to add PermissionMiddleware exception handling in app/Exceptions/Handler.php.

Use middleware in your routes.

Seeders

The seeders of this package are now publishable under the "seeders" tag. It will publish the RolePermissionSeeder seeder in the seeders folder in the database path via:

RolePermissionSeeder will seed basic permissions, create superadmin role, grant permissions to superadmin, and create one admin user as superadmin. Run the seeder via:

In RolePermissionSeeder.php, you can update permissions array according to your system needs. We included some basic one. You can always run this seeder when you added or updated your permissions. It helps to update accordingly.

In RolePermissionSeeder.php and Cyaoz94\LaravelUtilities\Models\AdminUser.php, we defaulted $guardName = 'admin'. You might want to change it to other guard name, example sanctum. You can create your own AdminUser model and extends our model. You need to update the guard name in both RolePermissionsSeedeer.php and AdminUser model.

Role Features

To use role related features (example RoleController), please register RolePolicy in AuthServiceProvider.

Testing

Changelog

Please see CHANGELOG for more information what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please contact your senior dev.

Credits

License

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

Laravel Package Boilerplate

This package was generated using the Laravel Package Boilerplate.


All versions of laravel-utilities with dependencies

PHP Build Version
Package Version
Requires php Version ^7.4|^8.0
illuminate/support Version ^8.0|^9.0
spatie/laravel-permission Version ^5.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 cyaoz94/laravel-utilities contains the following files

Loading the files please wait ....