2017 © Pedro PelĂĄez
 

library cake-php-yourls-plugin

image

adrianoluis/cake-php-yourls-plugin

  • Saturday, March 3, 2018
  • by blamoo
  • Repository
  • 0 Watchers
  • 2 Stars
  • 2 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 4 Versions
  • 0 % Grown

The README.md

CakePHP YOURLS Plugin

  • Author: Adriano LuĂ­s Rocha (adriano.luis.rocha@gmail.com)
  • Version: 1.0
  • license: MIT

Install and Setup

First add this repository as git submodule in your CakePHP project:, (*1)

git submodule add https://github.com/adrianoluis/CakePHP-YOURLS-Plugin.git APP/Plugin/Yourls
git submodule update --init

Once installed you'll need to create a file /APP/Config/yourls.php. You can find an example of what you'll need and how it is laid out in /Yourls/Config/yourls.php.example., (*2)

//app/Config/yourls.php
$config = array(
    'Yourls' => array(
        'url' => 'YOURLS_URL',
        'username' => 'YOURLS_USERNAME',
        'password' => 'YOURLS_PASSWORD',
    )
);

Usage

You can call the component from any action in a controller or automate url shortening just using the follow code in your /APP/Controller/AppController.php:, (*3)

public function beforeRender() {
    $this->shortIt = true;
    $this->pageTitle = 'your url title goes here'
}

PS: is necessary to provide a title for shorter method otherwise it will go in a infinite loop trying to resolve URL's title using YOURLS internal libs., (*4)

Than from yout view, access the shorted url using:, (*5)

<?php echo $shorturl['url']; ?>

To get statistics from all your links you need to choose between json or xml. This new setup changes the return from shorturl method., (*6)

public $components = array(
    'Yourls.Yourls' => array(
        'format' => 'xml'
    )
);

The Versions

03/03 2018

v0.7

0.7.0.0

  Sources   Download

03/03 2018

v1.0

1.0.0.0

  Sources   Download

03/03 2018

v0.6

0.6.0.0

  Sources   Download

29/01 2016

dev-master

9999999-dev

  Sources   Download

MIT

The Requires

 

by Adriano LuĂ­s Rocha