violinist-dev/slug-from-url

Get a slug from a URL

1.2.1 2019-05-16 13:52 UTC

This package is auto-updated.

Last update: 2024-11-17 02:27:46 UTC


README

Get a slug from a URL

Coverage Status Build Status Violinist enabled

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