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 (3 hours ago) RSS 2.0 feedNot yet rated by the usersTotal: Not yet counted Not yet ranked
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  
Name: Cauê Santana <contact>
Classes: 3 packages by
Country: Brazil Brazil
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

  Files folder image Files (46)  /  app  
File Role Description
Files folder imageConsole (1 file)
Files folder imageEvents (2 files)
Files folder imageExceptions (1 file)
Files folder imageHelpers (2 files)
Files folder imageHttp (2 directories)
Files folder imageJobs (2 files)
Files folder imageListeners (1 file)
Files folder imageModels (2 files)
Files folder imageProviders (3 files)

  Files folder image Files (46)  /  app  /  Console  
File Role Description
  Plain text file Kernel.php Class Class source

  Files folder image Files (46)  /  app  /  Events  
File Role Description
  Plain text file Event.php Class Class source
  Plain text file ExampleEvent.php Class Class source

  Files folder image Files (46)  /  app  /  Exceptions  
File Role Description
  Plain text file Handler.php Class Class source

  Files folder image Files (46)  /  app  /  Helpers  
File Role Description
  Plain text file MetricDataHandler.php Class Class source
  Plain text file ResponseFormatter.php Class Class source

  Files folder image Files (46)  /  app  /  Http  
File Role Description
Files folder imageControllers (1 file, 1 directory)
Files folder imageMiddleware (2 files)

  Files folder image Files (46)  /  app  /  Http  /  Controllers  
File Role Description
Files folder imageUrlManagement (3 files)
  Plain text file Controller.php Class Class source

  Files folder image Files (46)  /  app  /  Http  /  Controllers  /  UrlManagement  
File Role Description
  Plain text file CreateUrlController.php Class Class source
  Plain text file GetUrlInfoController.php Class Class source
  Plain text file RedirectController.php Class Class source

  Files folder image Files (46)  /  app  /  Http  /  Middleware  
File Role Description
  Plain text file Authenticate.php Class Class source
  Plain text file ExampleMiddleware.php Class Class source

  Files folder image Files (46)  /  app  /  Jobs  
File Role Description
  Plain text file ExampleJob.php Class Class source
  Plain text file Job.php Class Class source

  Files folder image Files (46)  /  app  /  Listeners  
File Role Description
  Plain text file ExampleListener.php Class Class source

  Files folder image Files (46)  /  app  /  Models  
File Role Description
  Plain text file Metric.php Class Class source
  Plain text file Url.php Class Class source

  Files folder image Files (46)  /  app  /  Providers  
File Role Description
  Plain text file AppServiceProvider.php Class Class source
  Plain text file AuthServiceProvider.php Class Class source
  Plain text file EventServiceProvider.php Class Class source

  Files folder image Files (46)  /  bootstrap  
File Role Description
  Plain text file app.php Class Class source

  Files folder image Files (46)  /  config  
File Role Description
  Accessible without login Plain text file database.php Aux. Configuration script

  Files folder image Files (46)  /  database  
File Role Description
Files folder imagefactories (2 files)
Files folder imagemigrations (5 files)
Files folder imageseeders (3 files)

  Files folder image Files (46)  /  database  /  factories  
File Role Description
  Plain text file MetricFactory.php Class Class source
  Plain text file UrlFactory.php Class Class source

  Files folder image Files (46)  /  database  /  migrations  
File Role Description
  Plain text file 2024_10_28_014000_create_urls_table.php Class Class source
  Plain text file 2024_10_30_003245_...e_metrics_table.php Class Class source
  Plain text file 2024_10_31_235948_...gent_to_metrics.php Class Class source
  Plain text file 2024_11_01_003510_...ks_from_metrics.php Class Class source
  Plain text file 2024_11_01_003603_..._clicks_to_urls.php Class Class source

  Files folder image Files (46)  /  database  /  seeders  
File Role Description
  Plain text file DatabaseSeeder.php Class Class source
  Plain text file MetricSeeder.php Class Class source
  Plain text file UrlSeeder.php Class Class source

  Files folder image Files (46)  /  public  
File Role Description
  Accessible without login Plain text file .htaccess Data Auxiliary data
  Accessible without login Plain text file index.php Example Example script

  Files folder image Files (46)  /  routes  
File Role Description
  Accessible without login Plain text file web.php Example Example script

  Files folder image Files (46)  /  tests  
File Role Description
  Plain text file ExampleTest.php Class Class source
  Plain text file TestCase.php Class Class source

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  
 100%
Total:0
This week:0