Download the PHP package toneflix-code/cuttly-php without Composer

On this page you can find all versions of the php package toneflix-code/cuttly-php. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package cuttly-php

Cutt.ly PHP

Test & Lint Latest Stable Version Total Downloads License PHP Version Require codecov

Cutt.ly is a Link Management Platform with all features you need in one place. Shorten your links, track clicks, and boost your brand with our all-in-one URL Shortener. Create custom short links, generate QR codes, build link-in-bio pages, and gather feedback with surveys. Start optimizing your URLs today and see the impact!y, this library aims to work around the Cutt.ly API implementation by providing a simple PHP wrapper arround it.

Please refere to Cutt.ly API Documentation for detailed api use description as this package tries to mirror the API in the best possible way.

If you use Laravel you might also want to checkout Cuttly Laravel

Requirements

Installation

You can install the package via composer:

Initialization

To start using this library you are required to configure your API keys in a .env file with these variables.

If your project does not have a .env file, you can create one at the root directory of your project. Alternatively your can pass the api key as parameters when you initialize the library.

With ENV file

Without ENV file

Initialization Errors

Where an API key is not provided, the library will throw a ToneflixCode\CuttlyPhp\Exceptions\InvalidApiKeyException exception and any other associated action call.

Regular API Usage

Shorten Url

To shorten a URL simply call the shorten(string) method chained to the regular() method of the Cuttly instance passing the link you intend to shorten as the only parameter.

The shorten() method returns an instance of ToneflixCode\CuttlyPhp\Builders\ShortenResponse which contains all properties of the request response returned by the API.

Chainable parameters

We have taken our time to ensure that while using this library, you have access to every available feature provided by cuttly in the first place, here is a list of parameters you can chain as methods to further customize your request.

Example Usage

Do note that shorten() should only be called at the end of the chain.

Edit Short Link

The library also allows you to edit the short links you have created. To edit a link simply call the edit(string) method chained to the regular() method of the Cuttly instance passing the short link you intend to edit as the only parameter.

Of course, the example above really does nothing and will throw a ToneflixCode\CuttlyPhp\Exceptions\FailedRequestException. To actually edit a link, you can chain any of the below methods to your call and voila.

Example Usage

The edit() method returns an instance of ToneflixCode\CuttlyPhp\Builders\BaseResponse which contains all properties of the request response returned by the API.

Link analytics

In order to access URL statistics call the stats(string) method chained to the regular() method of the Cuttly instance passing the short link you intend to get analytics of as the only parameter.

The stats() method returns an instance of ToneflixCode\CuttlyPhp\Builders\StatsResponse which contains all properties of the request response returned by the API.

Delete Short Link

To delete a short link call the delete(string) method chained to the regular() method of the Cuttly instance passing the short link you intend to get delete as the only parameter.

The delete() method returns an instance of ToneflixCode\CuttlyPhp\Builders\BaseResponse which contains all properties of the request response returned by the API.

Team API Usage

The team API implements the same methods and chainable methods available to the Regular API with a few exceptions that we will point out next.

TO use the Team API, instead of calling the regular() method on the Cuttly instance, we're going to call the team() method, you can now chain all the method we have highlighted above to use the Team API.

Shorten Link

Edit Short Link

Link analytics

Delete Short Link

Exceptions

ToneflixCode\CuttlyPhp\Exceptions\InvalidApiKeyException

The ToneflixCode\CuttlyPhp\Exceptions\InvalidApiKeyException exception is thrown whenever an API key has not been provided or an invalid API key has been provided.

ToneflixCode\CuttlyPhp\Exceptions\FailedRequestException

The ToneflixCode\CuttlyPhp\Exceptions\FailedRequestException exception is thrown whenever the Cuttly API returns an error.

Exception Handling

When you hit an exception, you can handle it in whatever way is best for your use case.

For detailed descriptino about what is obtainable from the API, please read the Cutt.ly Documentations.

Testing

Changelog

Please see CHANGELOG for more information what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email [email protected] instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.


All versions of cuttly-php with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1|^8.2|^8.3
guzzlehttp/guzzle Version ^7.9
symfony/http-client Version ^6.4|^7.1
vlucas/phpdotenv Version ^5.6
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package toneflix-code/cuttly-php contains the following files

Loading the files please wait ....