PHPackages                             kirilcvetkov/tesla-api - 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. [API Development](/categories/api)
4. /
5. kirilcvetkov/tesla-api

ActiveLibrary[API Development](/categories/api)

kirilcvetkov/tesla-api
======================

A simple Laravel package to help you connect to your Tesla(s).

v0.1.2(1y ago)017↓100%MITPHPPHP ^8.1

Since May 7Pushed 1y ago2 watchersCompare

[ Source](https://github.com/kirilcvetkov/tesla-api)[ Packagist](https://packagist.org/packages/kirilcvetkov/tesla-api)[ Docs](https://github.com/kirilcvetkov/tesla-api)[ RSS](/packages/kirilcvetkov-tesla-api/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (7)Versions (7)Used By (0)

🚘 Tesla API Package
===================

[](#-tesla-api-package)

This is a composer package that allows you to access your Tesla products through Tesla's API. You're able to view products, send commands, get metrics, and more from your Tesla account.

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

[](#installation)

You can install this package via composer:

```
composer require kirilcvetkov/tesla-api
```

Usage
-----

[](#usage)

#### Step 1 - Get a single-use Token

[](#step-1---get-a-single-use-token)

Generate a single-use token by authenticating yourself with the Tesla's auth page using your Tesla account credentials. This will be a direct connection to Tesla. After logging in, you'll arrive at "Page Not Found", which is to be expected. Look at the URL of this page and copy the `code` parameter. This is your single-use token.

Here's how to get a link to Tesla's auth page:

```
use KirilCvetkov\TeslaApi\Authenticate;

$url = Authenticate::create()->getLoginUrl();

echo 'Log into Tesla';
```

The URL of the "Page Not Found" page should look someything like this: `https://auth.tesla.com/void/callback?locale=en-US&code=NA_code_123&state=zzz&issuer=https%3A%2F%2Fauth.tesla.com%2Foauth2%2Fv3`

#### Step 2 - swap the single-use Token for a long-term Token

[](#step-2---swap-the-single-use-token-for-a-long-term-token)

Use the value of the `code` parameter to retrieve a long-term token:

```
use KirilCvetkov\TeslaApi\Authenticate;

$singleUseToken = 'NA_code_123';
$accessToken = Authenticate::create()->getToken($singleUseToken);

echo '';
var_export($accessToken);
```

With this token, you can access Tesla's API.

#### Step 3 - Access the API

[](#step-3---access-the-api)

```
use KirilCvetkov\TeslaApi\Tesla;

$tesla = Tesla::create($accessToken); // $accessToken comes from the previous example

$products = $tesla->products()->index();
echo 'Product count ' . $products->totalCount . 'Items ';
var_export($products->items);

$vehicles = $tesla->vehicles()->index();
echo 'Vehicle count ' . $vehicles->totalCount . 'Items ';
var_export($vehicles->items);
```

### Testing

[](#testing)

```
composer test
```

### Changelog

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

### Security

[](#security)

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

Credits
-------

[](#credits)

- [Kiril Cvetkov](https://github.com/kirilcvetkov)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance39

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity47

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~110 days

Recently: every ~126 days

Total

6

Last Release

547d ago

PHP version history (2 changes)v0.0.1PHP ^8.0

v0.0.2PHP ^8.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/8b589c8f1e3d8e0ee1238fa317548eea758897dd0961cf5685cd6ab74703bbad?d=identicon)[kirilcvetkov](/maintainers/kirilcvetkov)

---

Top Contributors

[![kirilcvetkov](https://avatars.githubusercontent.com/u/13462243?v=4)](https://github.com/kirilcvetkov "kirilcvetkov (39 commits)")

---

Tags

apicomposerteslatesla-apiteslamotorsteslakirilcvetkovtesla-api

###  Code Quality

TestsPHPUnit

Code StylePHP CS Fixer

### Embed Badge

![Health badge](/badges/kirilcvetkov-tesla-api/health.svg)

```
[![Health](https://phpackages.com/badges/kirilcvetkov-tesla-api/health.svg)](https://phpackages.com/packages/kirilcvetkov-tesla-api)
```

###  Alternatives

[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.4k5.6M647](/packages/sylius-sylius)[tencentcloud/tencentcloud-sdk-php

TencentCloudApi php sdk

3731.2M42](/packages/tencentcloud-tencentcloud-sdk-php)[convertkit/convertkitapi

Kit PHP SDK for the Kit API

2167.1k1](/packages/convertkit-convertkitapi)[mapado/rest-client-sdk

Rest Client SDK for hydra API

1125.9k2](/packages/mapado-rest-client-sdk)[linkstreet/box-sdk

v2 Box sdk for php

121.3k](/packages/linkstreet-box-sdk)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
