janhenkes / teamleader-php-sdk

Teamleader API v2 PHP SDK
MIT License
16 stars 25 forks source link

How to start #46

Closed jlegido closed 2 years ago

jlegido commented 3 years ago

Hi there.

First of all many thanks to all the people involved in this project for their time, I really appreciate it.

I would like to start using Teamleader API, but to be honest I still have not yet the concepts.

At the moment I created an integration, so I have a Client ID and a Secret ID.

Unfortunately reading your documentation I have no idea what comes next.

If somebody can provide a step by step guide of how to start using this SDK implementation I compromise to create a Pull Request to get all the information dumped on README file.

Thanks in advice.

janhenkes commented 3 years ago

Hi @jlegido ,

Please try the following:

Create a credentials.php file in the examples directory of this repository and give it the following content:

<?php
$clientId     = 'YOUR_CLIENT_ID';
$clientSecret = 'YOUR_CLIENT_SECRET';

Point your web server to the repository directory and name your host "teamleader-php-sdk.test". Go to https://teamleader-php-sdk.test/examples/acquire-access-token.php. If you have configured it correctly, you should be redirected to Teamleader and obtain access tokens.

You can also create a copy of acquire-access-token.php and replace "https://teamleader-php-sdk.test" with "http://localhost:8888". Next, go to the repository repo directory in your terminal and spin up PHP's built in webserver: php -S localhost:8888. You can now visit http://localhost:8888/examples/acquire-access-token.php in your browser.

Next, try visiting /examples/get-contacts.php.

I hope this helps.