violinist-dev/slug-from-url

Get a slug from a URL

1.1.1 2018-08-10 06:44 UTC

README

Get a slug from a URL

Coverage Status Build Status

Installation

composer require violinist-dev/slug-from-url

Usage

<?php

use Violinist\Slug\Slug;

// Probably uou want to use this directly from a URL somehow. Like so:
$slug = Slug::createFromUrl('https://github.com/violinist-dev/slug-from-url');
// Maybe you want the github slug:
$gh_slug = $slug->getSlug();       // Returns violinist-dev/slug-from-url
// Or maybe you want to get the username:
$username = $slug->getUserName();  // Returns violinist-dev
// ...or here is the repo name.
$repo = $slug->getUserRepo();      // Returns slug-from-url

Licence

MIT