PHP Classes

How to Implement a Simple PHP URL Shortener Using the Package URL Shortener API: API to create and access short URLs

Recommend this page to a friend!
     
  Info   Example   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Last Updated Ratings Unique User Downloads Download Rankings
2024-11-24 (4 months ago) RSS 2.0 feedNot enough user ratingsTotal: 20 All time: 11,349 This week: 31Up
Version License PHP version Categories
urlshortenerapi 1.0MIT/X Consortium ...5HTTP, PHP 5, Web services, Applications
Description 

Author

This package provides an API to create and access short URLs.

It provides an API application that can make HTTP requests to perform several actions.

Currently, it can:

- Create a short URL from a given long URL

- Get the long URL for a given short URL

- Get statistics on access to the short URL

Picture of CauĂȘ Santana
  Performance   Level  
Innovation award
Innovation award
Nominee: 1x

 

Instructions

How to Implement a Simple PHP URL Shortener Using the Package

Example

<?php

/*
|--------------------------------------------------------------------------
| Create The Application
|--------------------------------------------------------------------------
|
| First we need to get an application instance. This creates an instance
| of the application / container and bootstraps the application so it
| is ready to receive HTTP / Console requests from the environment.
|
*/

$app = require __DIR__.'/../bootstrap/app.php';

/*
|--------------------------------------------------------------------------
| Run The Application
|--------------------------------------------------------------------------
|
| Once we have the application, we can handle the incoming request
| through the kernel, and send the associated response back to
| the client's browser allowing them to enjoy the creative
| and wonderful application we have prepared for them.
|
*/

$app->run();


  Files folder image Files (46)  
File Role Description
Files folder imageapp (9 directories)
Files folder imagebootstrap (1 file)
Files folder imageconfig (1 file)
Files folder imagedatabase (3 directories)
Files folder imagepublic (2 files)
Files folder imageroutes (1 file)
Files folder imagetests (2 files)
Accessible without login Plain text file .editorconfig Data Auxiliary data
Accessible without login Plain text file .env.example Data Auxiliary data
Accessible without login Plain text file .styleci.yml Data Auxiliary data
Accessible without login Plain text file artisan Example Example script
Accessible without login Plain text file composer.json Data Auxiliary data
Accessible without login Plain text file composer.lock Data Auxiliary data
Accessible without login Plain text file phpcs.xml Data Auxiliary data
Accessible without login Plain text file phpunit.xml Data Auxiliary data
Accessible without login Plain text file README.md Doc. Documentation

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads Download Rankings  
 100%
Total:20
This week:0
All time:11,349
This week:31Up