Download the PHP package leoralph/signed-url without Composer

On this page you can find all versions of the php package leoralph/signed-url. 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 signed-url

Laravel Signed URLs

Enhanced signed URLs for Laravel, including attaching data, click limits and expiry.

Build Status Code Coverage Scrutinizer Code Quality Total Downloads Licence

Table of Contents

Introduction

Revamped URL signing brought to Laravel. Pass data through any url securely, and control expiry and number of clicks.

Version Compatibility

Laravel Url Signer
5.7.x 1.0.x
5.8.x 1.0.x
6.x 1.0.3 2.0.x
7.x 2.0.x
8.x 3.0.x
9.x 4.0.x
10.x 5.0.x

Getting Started

It couldn't be easier to install and set up url signing in your laravel app.

Installation

  1. Install through the composer package manager

  2. (Optional) Publish the assets

    You can also use the or flags to only publish the configuration files or the migrations.

  3. Run the migrations

Usage

Overview

This package works by modifying a URL to give it a signature. This must be a url you have registered in your routes. When the signed URL is opened in the browser, our middleware will not only inject the attached data into a controller request, but throw exceptions if the link has expired, been clicked too many times or altered in any way.

Creating a Link

Standard Link

The easiest way to create a link is through the facade:

The link can now be sent out or used just like normal signed URLs. You may also use the sign method, which is simply an alias for generate, and the alias instead of importing the full facade namespace

You can also resolve an instance of from the container and call the facade functions directly.

Data

Instead of encoding data into the url yourself, simply pass it as the second argument.

In your controller, e.g. InvitationController.php

Through this method, the data can't be altered by anyone and can't even be seen by users, securing your application and hiding implementation details.

Expiry

Additional to a basic link is the ability to set the expiry of the link. Only want a link to be available for 24 hours?

The expiry accepts a string, unix timestamp or a datetime instance (i.e. Carbon).

Click Limit

The number of clicks of a link can also be set. If you only want a user to be able to click a link one time:

The first time the link is clicked, the route will work like normal. The second time, since the link only has a single click, an exception will be thrown. Of course, passing instead of to the expiry parameter will create links of an indefinite lifetime.

Link Groups

By grouping links, the click limit may be spread across multiple links. Given a group with a click limit of 2 but 3 links will only allow two total clicks. Expiry is default for links unless they specify it themselves.

This will create two links, both with different data and expiring in 24 hours, but since the group click limit is 1 only a single link may be clicked. This is useful for situations in which you want to give the user a choice of links to click, such as for an invitation (the user should only be able to click 'Yes' or 'No' to respond).

The expiry parameter in a group is a default applied to all links in the group which don't have an expiry date. If you set the expiry date in the link in addition to the in the group, only the link expiry will be checked.

You can access the links using , which wll return a Laravel collection.

Handling a Link

Middleware

To enable exceptions to be thrown when a link is invalid in any way, simply add the middleware to any relevant routes. This will take care of:

Retrieving Link Information

We automatically put all data attached to a link into the request attributes. The following is a controller method called when a user clicks on a generated link with data attached.

Error handling

The middleware will throw exceptions when the link is invalid in any way. By default, these will be handled by Laravel to display an error page with a simple message.

By using your apps exception handler, you can choose to show custom pages to respond to each of the following situations by catching an error and returning a response:

Condition Exception
URL has been changed LinkNotFoundException
Signature was not found LinkNotFoundException
Link has been clicked too many times LinkClickLimitReachedException
Link group has been clicked too many times LinkGroupClickLimitReachedException
Link has expired LinkExpiredException
Link group has expired and link had no expiry LinkGroupExpiredException

Through using exception inheritance, you can control which pages to show for which exception, or just have a single page for all link exceptions. The inheritance diagram is shown below, with all classes being in the namespace except for .

Examples

Coming soon...

Contributing

Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are greatly appreciated. See CONTRIBUTING.md for more information.

  1. Fork the Project

  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)

  3. Commit your Changes (git commit -m 'Add some AmazingFeature)

  4. Push to the Branch (git push origin feature/AmazingFeature)

  5. Open a pull request

License

Distributed under the MIT License. See LICENSE for more information.

Contact

Toby Twigger - [email protected]

Project Link: https://github.com/linkeys-app/signed-url


All versions of signed-url with dependencies

PHP Build Version
Package Version
Requires php Version ^8.0
ramsey/uuid Version ^4.0
laravel/framework Version ^9.0|^10.0|^11.0
nesbot/carbon Version ^2.17
spatie/url Version ^2.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 leoralph/signed-url contains the following files

Loading the files please wait ....