Download the PHP package coderflexx/laravel-presenter without Composer

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

Laravel Presenter

The Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

A clean way to present your model attributes without putting them in the wrong file.

Installation

You can install the package via composer:

You can publish the config file with:

This is the contents of the published config file:

Usage

The implementation of this package is so simple, all what you need to do is the following:

Model Implementation

Create New Model Presenter class

This package gives you an easy way to generate new Presenter class, all you need to do is to use presenter:make command.

UserPresenter in our case, leaves by default in App\Presenters.

This is the contents of the UserPresenter file:

If you want to change the directory, you have two options.

First options is to set the full namespace while you're creating the presenter class

Or change presenter_namespace from config/laravel-presenter file.

Using the Presenter Generated Class

After you create the presenter class, you need to register it on the Model by adding the $presenters protected property:

By default, the type of your presenter class is default, but you can use as many of presenters you want, just by identifying the type in $presenters property.

Example

Now, after we generated the presenter class, and we implemented it successfully in our model, we can use it like so:

In your UserPresenter class or any presenter class you generated.

We add a new method to present the fullName.

In your blade or any place you want, you can do:

Your application will show the full name from the method you added.

Adding Another Presenter Type

Like I said above, by default the type will be default but, you can add more types as you need.

Here is an example:

Generate new UserSettingPresenter

Add anything to UserSettingPresenter method

Finally, set setting as a type:

By that, you can split your logic and make your code base even cleaner.

Testing

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.

Credits

License

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


All versions of laravel-presenter with dependencies

PHP Build Version
Package Version
Requires php Version ^8.0|^8.1
spatie/laravel-package-tools Version ^1.9.2
illuminate/console Version ^8.75|^9.0|^10.0|^11.0
illuminate/contracts Version ^8.0|^9.0|^10.0|^11.0
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 coderflexx/laravel-presenter contains the following files

Loading the files please wait ....