Skip to content

Instantly share code, notes, and snippets.

@vallieres
Last active January 27, 2016 18:20
Show Gist options
  • Save vallieres/7f8fef7d8de3d3e422ce to your computer and use it in GitHub Desktop.
Save vallieres/7f8fef7d8de3d3e422ce to your computer and use it in GitHub Desktop.
Simple API Endpoint That Uses Cocur/Slugify to Transform the Title of Artilces, , all the details on https://hipsterpixel.co/2016/01/27/my-blog-publishing-workflow-on-ios-part-1-tutorial
require 'vendor/autoload.php';
use Cocur\Slugify\Slugify;
/* This goes inside your API function */
header('Content-Type:text/plain');
$slugify = new Slugify();
echo $slugify->slugify($string);
/*
"A Great Article" will become "a-great-article"
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment