Download the PHP package ac-developers/eloquent-url-presenter without Composer

On this page you can find all versions of the php package ac-developers/eloquent-url-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 eloquent-url-presenter

Laravel Url Presenter

This is a simple presenter much like the Laracast Presenter but specifically tailored for presenting urls in Laravel as suggested by a post on laravel-news.com writen by Jordan Dalton.

1.1. Setting up

1.1.1. Installation on Lumen 5.x and Laravel 5.x.

Add the Laravel Form Processor package to your composer.json file.

Auto-discovery: Is supported in Laravel Form Processor auto-discovery for Laravel 5.5 and greater.

1.1.2. Installation on Lumen and Laravel 5.4 and below.

1.1.2.1. Service Provider

In your app config, add the EloquentUrlPresenterServiceProvider to the providers array.

For Lumen, add the provider to your bootstrap/app.php file.

1.1.3. Publishing config file.

To publish the config file to config/eloquent-url-presenter.php run:

1.1.4. Configure paths for generated processes

To change the paths of saving the generated url presenters, you need to configure their namespaces in a configuration file config/ac-developers/eloquent-url-presenter.php.

After this your good to go.

1.2. Usage

1.2.1. Creating a url presenter

Creating a url presenter class is as easy as creating any other php class with just a few steps required to make it url presentable. In our case we will create a UserUrlPresenter class.

first it extends our EloquentUrlPresenterClass. Next you pass in the eloquent model that would be making use of the newly created url presenter in to it's constructor like this:

Then create the method that would return the desired url.

If your on Laravel or Lumen and you want to make this presenter resoucesful without manually adding the methods one by one you just have to add the HasResource trait to the UrlPresenter and implement the route method which should return a string similar to that passed in as first argument in the Route::resouce method and the parameter method which does exactly what you would expect.

So if in your route method looks like Route::resource('users', 'UserController') then the route method implemented in the UserUrlPresenter should return users else laravel will throw an exception.

And the next is to prepare our model to use our url presenter.

1.2.1. Preparing model to use Url Presenter

Preparing the model that would use the url presenter is simple, Just use the EloquentUrlPresentableTrait and then implementing the urlPresenter methord which will return our UserUrlPresenter class

Next we will add "url" to our appends property array like this:

Next you add url as an array value in our model's appends property and then your done.

Now in our code we can link to our user model show page like this:

Lets say your using the HasResource trait you'll automatically have access to all resourcful route methods and these includes index, create, show, edit, store, update and destroy

1.3. Laravel url presenter command

**Note: This is to be used only in Laravel and Lumen applications

Ofcause the following steps narrated previously was to show you how to do it yourself. You can skip this and just run the php artisan generate:urlPresenter command. For example to create our UserUrlPresenter we would do like this:

To make a resourceful url presenter all you have to do is pass the resouces option while generating the url presenter without a value like so:

1.3. Security Vulnerabilities

If you discover a security vulnerability within Laravel Form Processor, please send an e-mail to Anitche Chisom via [email protected]. All security vulnerabilities will be promptly addressed.

1.4. License

The Eloquent Url Presenter is open-sourced software licensed under the MIT license.


All versions of eloquent-url-presenter with dependencies

PHP Build Version
Package Version
Requires php Version ^7.1.0
illuminate/config Version ~5.0
illuminate/support Version ~5.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 ac-developers/eloquent-url-presenter contains the following files

Loading the files please wait ....