Download the PHP package genericmilk/telephone without Composer

On this page you can find all versions of the php package genericmilk/telephone. 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 telephone

👴 This repo is archived and is no longer maintained as Laravel has run out a first party alternative that is way better! Switch to https://laravel.com/docs/8.x/requests to get started

📱 Telephone

By Genericmilk

Telephone is a lovely frontend to PHP's cURL that allows quick and easy GET and POST requests to JSON led api's!

Why use this over cURL?

Simple! While yes it's definetely possible to use cURL, this dramatically simplifies the process down to 1-3 lines of code and most importantly, respond as a PHP Object ready to go for navigation! It makes for a more readable more traversible request

Install Telephone

To get started using Telephone you need to add it to your composer.json file. You can do this by running the following command

This'll install the prerequisites to get Telephone working.

Using Telephone

To get started using Telephone in your controller, You need to import it. Add this to the top of your controller to get started;

Now that you've added Telephone to your controller, you can use it to build requests!

Creating a GET request without authorisation using Telephone

Get requests using Telephone are made up of two parts, The url and any headers you want to use. If you have no header information you need to pass such as bearer tokens, You can make a request as such

The value of $RingRing will be a PHP Object of the response the api delivered. You can then traverse it as such;

And of course if you have more than one item in the response, simply iterate over it using a foreach like so;

Creating a GET request with authorisation using Telephone

If you need to pass authorisation into your request, for example by means of a Bearer Token you can do so by adding it to the chain like so

Extending headers

If you need to add more to the headers array you can do so by adding the following

You can extend the header array as you need using this method. Any data will be sent along with the request

Creating a POST request using Telephone

Creating a POST request is pretty much similar to how GET requests are made, with the key difference there is space for another array which will be sent as form-data in the post request if you need.

You can use the request like so;

You can scale up or down this request as you see fit. If you do not provide an array (i.e. a POST request without form-data) simply don't include it in your request like so;

Telephone will not send any data if no array exists by default.

Failed requests

If Telephone recieves anything outside of a 200, by default it'll throw an exception. You can change this behaviour in a later version via the means of configs!

Roadmap

I really hope you love using Telephone. It should really aide with readability of your API requests and by converting data into a native PHP object speeds up the workflow! I've got plans to allow XML endpoints as well as more configuration and defaults, so if you have a common bearer token, you can add it to all requests meeting a certain pattern. Let me know your thoughts! Love you guys 🥰


All versions of telephone with dependencies

PHP Build Version
Package Version
Requires php Version >=7.0
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 genericmilk/telephone contains the following files

Loading the files please wait ....