Skip to content

momentohq/client-sdk-php

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

logo

project status project stability

Momento Client Library for PHP

Momento Cache is a fast, simple, pay-as-you-go caching solution without any of the operational overhead required by traditional caching solutions. This repo contains the source code for the Momento client library for PHP.

To get started with Momento you will need a Momento Auth Token. You can get one from the Momento Console.

Japanese: 日本語

Packages

The Momento SDK for PHP package is available on packagist.org: client-sdk-php

Usage

<?php
require "vendor/autoload.php";
use Momento\Auth\CredentialProvider;
use Momento\Cache\CacheClient;
use Momento\Config\Configurations\Laptop;

$client = new CacheClient(
    Laptop::latest(), CredentialProvider::fromEnvironmentVariable("MOMENTO_API_KEY"), 60
);
$client->createCache("cache");
$client->set("cache", "myKey", "myValue");
$response = $client->get("cache", "myKey");
if ($hit = $response->asHit()) {
    print("Got value: {$hit->valueString()}\n");
}

Getting Started and Documentation

To get started with Momento you will need a Momento API key. You can get one from the Momento Console.

Documentation is available on the Momento Docs website.

Examples

Working example projects, with all required build configuration files, are available in the examples directory.

Developing

If you are interested in contributing to the SDK, please see the CONTRIBUTING docs.

Attributions

This product includes PHP software, freely available from http://www.php.net/software/


For more info, visit our website at https://gomomento.com!