phpShort: URL Shortener Platform  # matchurl

phpShort: URL Shortener Platform # matchurl

07.Oct.2021

phpShort is an advanced URL shortener platform that allows you to easily shorten links and target your audience based on their location or platform. This URL shortener with statistics provides analytics insights for the shortened links, also based on the user's location and preferences. It is built with the Laravel framework on the back-end and Bootstrap on the front-end, both of which make it extremely easy to customize and expand in the future.

How to install: Composer create project using bellow command:

composer create-project --prefer-dist laravel/laravel phpshort 2. Add api key: go to file config/app.php find providers array add ApiKeyModel service provider from github here 3. Add your server api key in file .env 4. finally run bellow command: php artisan key:generate

phpShort is a Laravel and Bootstrap based project that allows you to target users depending on their location and preferences, using the GeoIP service from Maxmind. It offers detailed insight into your statistics and analytics, including per platform results, number of clicks and more.

Features:

- Time zone support - Time zone support - Ability to add custom links - Custom categories - Custom platforms - Support for mobile platforms (simplified URL) - Analytics dashboard with all detailed results - Detailed insights about each platform - Proxy support - Ability to delete account & links

Requirements: - PHP 5.4+ - MySQLi extension for PHP

Installation:

- Install Composer - Run the following command in your project directory to create an Existing Laravel project: ```composer create-project laravel/laravel phpShort 2. Add api key ```php composer require hkdpn/phpshort 3. Create a new file config/app.php and add 'hkdpn\phpshort\Provider' to the end of the providers array, after this update auth section array with providers : ``` 'providers' => [ .... 'hkdpn\\phpshort\\PhpshortServiceProvider', ], 4. Publish file config/phpshort.php and change api key in `config/phpshort.php`

TODO: - Improve the design of 'phpshort.com' front-end - Improve analytics dashboard 5. Update .env file with your server API key 6. finally run bellow command: php artisan key:generate

phpShort is an advanced URL shortener platform that allows you to easily shorten links and target your audience based on their location or platform. This URL shortener with statistics provides analytics insights for the shortened links, also based on the user's location and preferences. It is built with the Laravel framework on the back-end and Bootstrap on the front-end, both of which make it extremely easy to customize and expand in the future.

To install phpShort follow these steps (don't worry, installation will take only 5 minutes):

1. Create new Laravel project using composer command below: composer create-project --prefer-dist laravel/laravel phpshort 2. Create new file in the root directory .env and add key: phpShort_apiKey=YOUR-API-KEY 3. Run php artisan migrate 4. Configure api keys in config/phpshort.php 5. Finally run below command: php artisan key:generate

 

 

class PhpshortController extends Controller

URL generator

URL generation with api key - PhpShort\Api\UrlGenerator::generate($length=10,$category='',$platforms=null,$fullurl='',$addedByUser=-1);

API KEY

- Get API KEY in config/phpshort.php file

- Add your api key to .env file and run below command: php artisan key:generate(); public function index() { return View::make('index'); }

Public methods

- Create new link - Delete link from database - Update link from database

Link View

- View for edit & delete links form

Stats controller

- Get Stats from database - Add new stats to db table - View all statistics available for a user - View statistic detail by platform or by date

Link Controller file: app/Http/Controllers/PhpshortController.php ``` middleware('auth'); } /** * Show the application dashboard. * * @return \Symfony\Component\HttpFoundation\Response */ public function index() { return View::make('index'); } /** * Show the application dashboard. * * @param string $category Category !!! * @return \Symfony\Component\HttpFoundation\Response */ public function show(string $category) { return View::make('view', ['category' => $category]); } /** * Store a newly created resource in storage. * * @param string $requestPath The URI-encoded path to the new link's location. * @param Link $link The new link information supplied by user on form submission. */ public function store(Request $request,Link $link){ //create new entry if not exist if (!$this->createEntry($request,$link)){ return Redirect::route('phpshort.create') ->withInput() ->withErrors(['url' => 'The {url} field is required.']); } //get link url $this->getLinkUrl($request,$link); } /** * Get the full URL for a given short name in this system's domain. * * @param Request $request The request object used for this request. * @param string $shortname The short name. * @return \Illuminate\Http\Request */ public function getLinkUrl(Request $request,string $shortname){

 

- Open file app/Http/Controllers/PhpshortController.php

- Copy bellow code in LinkController class ``` /** * Display an index page. * * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View */ public function __construct() { $this->middleware('auth'); } /** * Show the application dashboard. * * @return \Symfony\Component\HttpFoundation\Response */ public function index() { return View::make('index'); } /** * Show the application dashboard. * * @param string $category Category !!! * @return \Symfony\Component\HttpFoundation\Response */ public function show(string $category) { return View::make('view

 

We are social