Download the PHP package mremi/url-shortener-bundle without Composer

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

MremiUrlShortenerBundle

SensioLabsInsight

Build Status Total Downloads Latest Stable Version Scrutinizer Code Quality Code Coverage

This bundle implements the UrlShortener library for Symfony.

License

This bundle is available under the MIT license.

Prerequisites

This version of the bundle requires Symfony 2.8, 3.0 or newer.

For compatibility with Symfony 2.7 or earlier, please use 1.0.* versions of this bundle.

Basic Docs

Installation

Installation is a quick 5 step process:

  1. Download MremiUrlShortenerBundle using composer
  2. Enable the Bundle
  3. Create your Link class (optional)
  4. Configure the MremiUrlShortenerBundle
  5. Update your database schema (optional)

Step 1: Download MremiUrlShortenerBundle using composer

Require mremi/url-shortener-bundle via composer:

Note: if you are using Symfony 2.7 or earlier, please require ~1.0.0 version:

Composer will modify your composer.json file and install the bundle to your project's vendor/mremi directory.

Step 2: Enable the bundle

Enable the bundle in the kernel:

Step 3: Create your Link class (optional)

The goal of this bundle is not to persist some Link class to a database, but you can if you want just by following next instructions. So if you don't need to do this, you can jump to the next step.

Your first job, then, is to create the Link class for your application. This class can look and act however you want: add any properties or methods you find useful. This is your Link class.

The bundle provides base classes which are already mapped for most fields to make it easier to create your entity. Here is how you use it:

  1. Extend the base Link class from the Entity folder
  2. Map the id field. It must be protected as it is inherited from the parent class
  3. Add index on long_url column: Doctrine does not allow to specify index size in the mapping, so you have to write it manually in a migration class.

Note:

For now, only Doctrine ORM is handled by this bundle (any PR will be appreciated :) ).

Step 4: Configure the MremiUrlShortenerBundle

Fow now, you just have to configure your Bit.ly username and password.

Step 5: Update your database schema (optional)

If you configured the data storage (step 3), you can now update your database schema.

If you want to first see the create table query:

Then you can run it:

Chain providers

One service allow you to shorten/expand URL, to use like this:

Custom provider

You can add your own provider to the chain providers:

  1. Create a service which implements \Mremi\UrlShortener\Provider\UrlShortenerProviderInterface
  2. Add the tag mremi_url_shortener.provider

Test configured providers

You can now test the providers you configured with the following command line:

Retrieve link

You can retrieve some links using these finders:

If you configured the data storage (steps 3 & 5), finders look first in database ; if the link exists then return it, otherwise an API call will be done and link will be saved.

Else this will consume an API call.

Twig functions

You can also simply shorten/expand a URL from a twig file. It should be used with caution if no data storage is configured, because it's not HTTP friendly.

Profiler

If your are in debug mode (see your front controller), you can check in the web debug toolbar the configured providers and some statistics from the current HTTP request: number of requests per provider, consumed memory, request duration...

Screenshot

Contribution

Any question or feedback? Open an issue and I will try to reply quickly.

A feature is missing here? Feel free to create a pull request to solve it!

I hope this has been useful and has helped you. If so, share it and recommend it! :)

@mremitsme


All versions of url-shortener-bundle with dependencies

PHP Build Version
Package Version
Requires php Version >=5.3.3
symfony/framework-bundle Version ~2.8 | ~3.0
mremi/url-shortener Version ~1.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 mremi/url-shortener-bundle contains the following files

Loading the files please wait ....