PHPackages                             pdmfc/short-url-package-php-8-support - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. pdmfc/short-url-package-php-8-support

ActiveLibrary

pdmfc/short-url-package-php-8-support
=====================================

Url Shortener

05.6k↓50%PHP

Since Feb 15Pushed 2y ago1 watchersCompare

[ Source](https://github.com/pdmfc/short-url-package-php-8-support)[ Packagist](https://packagist.org/packages/pdmfc/short-url-package-php-8-support)[ RSS](/packages/pdmfc-short-url-package-php-8-support/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

🔗 Short Url Package 🔗
=====================

[](#link-short-url-package-link)

> A Http client to interact with the Short Url api service offered by [PDM](https://www.pdmfc.com/)

---

Table of contents
-----------------

[](#table-of-contents)

- [Installation](#installation)
- [Api](#api)
    - [get](#geturlstring-shorturl)
    - [create](#createurlarray-params)
    - [change](#changeurlstring-shorturl-array-params)
    - [delete](#deleteurlstring-shorturl)
    - [Request Params available](#params)
- [Tests](#tests)

Installation
------------

[](#installation)

### Composer:

[](#composer)

- In your `composer.json` add the following to the `"repositories"` section:

```
{
    "type": "vcs",
    "url": "https://github.com/pdmfc/short-url-package-php-8-support.git"
}
```

- Require the package:

```
composer require pdmfc/short-url-package-php-8-support
```

### Configuration

[](#configuration)

- Publish the config file:

```
php artisan vendor:publish --tag="short_config"
```

- Add the following environment variables to your `.env` file with the necessary values defined for your current application:

```
SHORT_URL_API_ID=
SHORT_URL_API_TOKEN=
SHORT_URL_API_BASE_URL=
```

Api
---

[](#api)

- If the request headers are incorrect, the response will be the following:

```
{
    "message": "Access is not allowed"
}
```

---

### `getUrl(string $shortUrl)`

[](#geturlstring-shorturl)

**Usage:**

```
use Pdmfc\Shorturl\Client\ShortUrlClient;

$client = new ShortUrlClient();

$response = $client->getUrl('Nc');
```

**Successful response:**

```
{
  "Id": 2,
  "shortUrl": "http://teste.ll/Nc",
  "qr_code": "
