Download the PHP package ghunti/laravel-base without Composer

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

Laravel Base

This is a packaged that brings small improvements to the Laravel framework.

All the improvements were made keeping in mind the Laravel way and good development practices. If you want to contribute don't hesitate.

Installation

Add the following middleware to the app/Http/Middleware:

Features

Permission Denied Exception

Exception/PermissionDeniedException.php

I like to use exceptions on my controllers to have a cleaner code followed by a bunch of catches, so this is just an exception that I throw whenever a user doesn't have enough permissions or is not logged in.

Validator

Validation/Validator.php

This is an extension to the Illuminate\Validation\Validator and adds a single method passOrFail.

If the validation fails, the method will create a new Ghunti\LaravelBase\Exception\ValidatorException and inject itself into the exception, throwing it.

Validator Exception

Exception/ValidatorException.php

This is an exception that holds the failed validation object. The idea is to use it like this:

As you can see, this ways we can retrieve the validator from the exception ($e->getValidator()) to use it in any way we want.

Redirect With Messages

I like the way Laravel redirects the errors and makes them available on the views, so I've implemented the same logic for any message with the method withMessages().

Check that i'm passing an array to the withMessages() method and I'm even specifying a type for the message so latter on the view I can do:

Base Model

Models/BaseModel.php

The BaseModel is an abstract class that extends Eloquent and provides the method getValidationRules(). This method will return the validation rules for the current model, and wil cal the getCreateRules() method if the current model doesn't exist, or the getEditRules()method if it does.

If instead of extendind Eloquent you extend the BaseModel you end up with the possibility to call the getValidationRules() method anywhere in your code and be sure to get the proper validation rules.

Base Repository

Repositories/BaseRepository.php

The BaseRepository tries to separate the idea of repository from model/entity since there are some "questions" that should be answered by the repository and others by the model/entity.

The idea is that your repository includes all the methods that can hit the database (or any other storage system) and in some cases even return models.

Imagine that you want to list all your users ordered by their name so you create the allOrderedByName method. Instead of implementing this method in the model you implement it in the repository (that will end up calling the model):

Scopes are also supported by the base repository, so you can code the scopes in your repository instead of the model

License

MIT


All versions of laravel-base with dependencies

PHP Build Version
Package Version
Requires php Version >=7.0.0
illuminate/contracts Version 5.5.*
illuminate/database Version 5.5.*
illuminate/http Version 5.5.*
illuminate/routing Version 5.5.*
illuminate/support Version 5.5.*
illuminate/validation Version 5.5.*
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 ghunti/laravel-base contains the following files

Loading the files please wait ....