# metricool/2.1.1/app/Http/Metricool/Entities/UserCredentials.php

Metricool – Social media and site statistics, version 2.1.1. 36 lines.

- Page: https://pluginprobe.com/plugins/metricool/2.1.1/code/app/Http/Metricool/Entities/UserCredentials.php
- Raw: https://pluginprobe.com/plugins/metricool/2.1.1/raw/app/Http/Metricool/Entities/UserCredentials.php
- Modified: 2026-08-20T14:08:30+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/metricool/2.1.1/code/app/Http/Metricool/Entities/UserCredentials.php#L10-L20`.

```php
<?php

declare(strict_types=1);

namespace Metricool\Http\Metricool\Entities;

use Metricool\Http\Metricool\Exceptions\ApiException;
use Metricool\Http\Metricool\MetricoolClient;

class UserCredentials
{
    protected MetricoolClient $client;
    protected string $endpoint;

    public function __construct(MetricoolClient $client)
    {
        $this->client = $client;
        $this->endpoint = 'v2/settings/users/' . $client->getUserId() . '/credentials';
    }

    /**
     * Update the user password
     *
     * @throws ApiException
     */
    public function updatePassword(string $oldPassword, string $newPassword): array
    {
         $this->client->patch($this->endpoint . '?fields=password', [
             'oldPassword' => $oldPassword,
             'password' => $newPassword,
         ]);

        return ['success' => true];
    }
}

```
