Giter Site home page Giter Site logo

techspecs / techspecs-php Goto Github PK

View Code? Open in Web Editor NEW
2.0 1.0 4.0 28 KB

This PHP SDK provides access to the standardized technical specifications of over 19,000 consumer electronics devices, including the latest smartphones, tablets, smartwatches, laptops, and more.

Home Page: https://developer.techspecs.io

License: MIT License

PHP 100.00%
consumer-electronics laptops php smartphone-data smartphones smartwatches specs tablets technical-specifications techspecs

techspecs-php's Introduction

TechSpecs Logo TechSpecs Logo

Introducing TechSpecs PHP

This php library provides automatic access to the standardized technical specifications of the world's consumer electronics, including the latest smartphones, tablets, smartwatches, laptops, and more.

Documentation

API Key

Requirements

  • PHP 7.4+
  • Composer

Installation

composer require techspecs/techspecs-php

Usage

The library needs to be configured with your account's api key and base which is available in your TechSpecs Dashboard.

Set $techSpecsKey to your key value and $techSpecsBase to your base value.

Basic Search

Search for a device by specifying it's model name, version number or features

require 'vendor/autoload.php';

// Importing the SDK class
use TechSpecsSDK\TechSpecsSDK;

// TechSpecs API Key
$techSpecsKey = 'techspecs_api_key';

// TechSpecs base https://apis.dashboard.techspecs.io/{techspecs_base}
$techSpecsBase = 'a8TD3mkN49fhg2y';

// Instantiate the Library
$techSpecs = new TechSpecsSDK($techSpecsBase, $techSpecsKey);

// product name or version number to search
$keyword = 'iPhone 13';

// product category to search
$category = ['all'];

// choose between "pretty" or "raw" mode for viewing response
$response = $techSpecs->search($keyword, $category, 'pretty');

// print the search results
print($response);

Advanced Search

List all products by brand, category and release date

require 'vendor/autoload.php';

// Importing the SDK class
use TechSpecsSDK\TechSpecsSDK;

// TechSpecs API Key
$techSpecsKey = 'techspecs_api_key';

// TechSpecs base https://apis.dashboard.techspecs.io/{techspecs_base}
$techSpecsBase = 'a8TD3mkN49fhg2y';

// Instantiate the Library
$techSpecs = new TechSpecsSDK($techSpecsBase, $techSpecsKey);

// enter the page number to fetch results from
$page = 1;

/**
 * Type in the name of the brand you're looking for
 * or leave this field empty to see results from all brands
 */
$brand = ['Apple'];

/**
 * Type in the name of the category you're looking for
 * or leave this field empty to see results from all categories
 */
$category = ['smartphone'];

/**
 * Please provide a date range to narrow your search.
 * Leave this field empty to fetch all results from all dates
 */
$dateFrom = '2010-01-01'; // YYYY-MM-DD
$dateTo = '2022-03-15'; // YYYY-MM-DD

// Choose between "pretty" or "raw" mode for viewing response
$response = $techSpecs->products(
    $brand,
    $category,
    $dateFrom,
    $dateTo,
    $page,
    'pretty'
);

// Print the search results
print($response);

Product Details

require 'vendor/autoload.php';

// Importing the SDK class
use TechSpecsSDK\TechSpecsSDK;

// TechSpecs API Key
$techSpecsKey = 'techspecs_api_key';

// TechSpecs base https://apis.dashboard.techspecs.io/{techspecs_base}
$techSpecsBase = 'a8TD3mkN49fhg2y';

// Instantiate the Library
$techSpecs = new TechSpecsSDK($techSpecsBase, $techSpecsKey);

// TechSpecs product id
$techspecsId = '6186b047987cda5f88311983';

// choose between "pretty" or "raw" mode for viewing response
$response = $techSpecs->productDetail($techspecsId, 'pretty');

// print the specifications of the product
print($response);

List all brands

require 'vendor/autoload.php';

// Importing the SDK class
use TechSpecsSDK\TechSpecsSDK;

// TechSpecs API Key
$techSpecsKey = 'techspecs_api_key';

// TechSpecs base https://apis.dashboard.techspecs.io/{techspecs_base}
$techSpecsBase = 'a8TD3mkN49fhg2y';

// Instantiate the Library
$techSpecs = new TechSpecsSDK($techSpecsBase, $techSpecsKey);

// choose between "pretty" or "raw" mode for viewing response
$response = $techSpecs->brands('pretty');

// print the search results
print($response);

List all categories

require 'vendor/autoload.php';

// Importing the SDK class
use TechSpecsSDK\TechSpecsSDK;

// TechSpecs API Key
$techSpecsKey = 'techspecs_api_key';

// TechSpecs base https://apis.dashboard.techspecs.io/{techspecs_base}
$techSpecsBase = 'a8TD3mkN49fhg2y';
// Instantiate the Library
$techSpecs = new TechSpecsSDK($techSpecsBase, $techSpecsKey);

// choose between "pretty" or "raw" mode for viewing response
$response = $techSpecs->categories('pretty');

// print the list of all categories
print($response);

techspecs-php's People

Contributors

kny00 avatar realtechspecs avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Forkers

emycodes

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.