Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/adrianoluis/CakePHP-YOURLS-Plugin
Plugin which integrates CakePHP with Yourls (Your Own URL Shortener).
https://github.com/adrianoluis/CakePHP-YOURLS-Plugin
Last synced: 2 months ago
JSON representation
Plugin which integrates CakePHP with Yourls (Your Own URL Shortener).
- Host: GitHub
- URL: https://github.com/adrianoluis/CakePHP-YOURLS-Plugin
- Owner: adrianoluis
- Archived: true
- Created: 2011-09-05T23:05:25.000Z (over 13 years ago)
- Default Branch: master
- Last Pushed: 2016-01-29T18:37:24.000Z (almost 9 years ago)
- Last Synced: 2024-08-02T06:19:20.643Z (5 months ago)
- Language: PHP
- Homepage:
- Size: 41 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome - CakePHP - Plugin to integrate YOURLS. (Integrations / 3rd party Integrations and Frameworks)
README
# CakePHP YOURLS Plugin
* Author: Adriano Luís Rocha ([email protected])
* Version: 1.0
* license: MIT# Install and Setup
First add this repository as git submodule in your CakePHP project:git submodule add https://github.com/adrianoluis/CakePHP-YOURLS-Plugin.git APP/Plugin/Yourls
git submodule update --initOnce 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`.
//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`: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.
Than from yout view, access the shorted url using:
To get statistics from all your links you need to choose between json or xml. This new setup changes the return from shorturl method.
public $components = array(
'Yourls.Yourls' => array(
'format' => 'xml'
)
);