PHPackages                             twingly/twingly-search - 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. twingly/twingly-search

ActiveLibrary[API Development](/categories/api)

twingly/twingly-search
======================

Twingly Search API for PHP

2.1.1(8y ago)12003[1 issues](https://github.com/twingly/twingly-search-api-php/issues)MITPHPPHP &gt;=5.6.0CI failing

Since Feb 11Pushed 2y ago2 watchersCompare

[ Source](https://github.com/twingly/twingly-search-api-php)[ Packagist](https://packagist.org/packages/twingly/twingly-search)[ RSS](/packages/twingly-twingly-search/feed)WikiDiscussions master Synced 4w ago

READMEChangelogDependencies (4)Versions (6)Used By (0)

Twingly Search API PHP
======================

[](#twingly-search-api-php)

[![GitHub Build Status](https://github.com/twingly/twingly-search-api-php/workflows/CI/badge.svg?branch=master)](https://github.com/twingly/twingly-search-api-php/actions)

A PHP library for Twingly's Search API (previously known as Analytics API). Twingly is a blog search service that provides a searchable API known as [Twingly Search API](https://app.twingly.com/blog_search?tab=documentation).

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

[](#installation)

Install via Composer

```
php composer.phar require twingly/twingly-search

# Or if you have installed composer globally
composer require twingly/twingly-search
```

Usage
-----

[](#usage)

```
use Twingly\Client;

$client = new Client();

$query = $client->query();
$query->search_query = 'github page-size:10 lang:sv';
$result = $query->execute();

foreach($result->posts as $post) {
    echo $post->url . "\n";
}
```

The `twingly-search` library talks to a commercial blog search API and requires an API key. Best practice is to set the `TWINGLY_SEARCH_KEY` environment variable to the obtained key. `\Twingly\Client` can be passed a key at initialization if your setup does not allow environment variables.

This library is documented with [phpdoc](http://www.phpdoc.org/). To generate documentation call

```
phpdoc -d ./src -t ./docs
```

Example code can be found in [examples/](examples/).

To learn more about the capabilities of the API, please read the [Twingly Search API documentation](https://app.twingly.com/blog_search?tab=documentation).

Requirements
------------

[](#requirements)

- API key, [sign up](https://www.twingly.com/try-for-free) via [twingly.com](https://www.twingly.com/) to get one
- PHP 7.x, 8.x

Development
-----------

[](#development)

Install PHP and [Composer](https://getcomposer.org/), on OS X:

```
brew install php@7.4
brew install composer

```

Install project dependencies:

```
composer install

```

Run tests:

```
./vendor/bin/phpunit

```

Run examples:

```
TWINGLY_SEARCH_KEY= php examples/hello_world.php

```

### Release

[](#release)

#### Make the release

[](#make-the-release)

`twingly-search` is released on [Packagist](https://packagist.org).

1. Bump the version in [Client.php](src/Client.php), follow [Semantic Versioning 2.0.0](http://semver.org/).
2. Create a tag with the same version and push it to GitHub:

    ```
     git tag  && git push --follow-tags

    ```
3. You're done! (*This repo has a GitHub service hook that notifies [Packagist](https://packagist.org) when a new version is created.*)

#### Update the changelog

[](#update-the-changelog)

- Install [GitHub Changelog Generator](https://github.com/skywinder/github-changelog-generator/) if you don't have it
    - `gem install github_changelog_generator`
- Set `CHANGELOG_GITHUB_TOKEN` to a personal access token to increase your GitHub API rate limit
- Generate the changelog
    - `github_changelog_generator`

License
-------

[](#license)

The MIT License (MIT)

Copyright (c) 2016 Twingly AB

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

###  Health Score

26

—

LowBetter than 41% of packages

Maintenance0

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community18

Small or concentrated contributor base

Maturity62

Established project with proven stability

 Bus Factor1

Top contributor holds 52.2% 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 ~154 days

Total

5

Last Release

3176d ago

Major Versions

1.1.0 → 2.0.02017-05-22

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/280263?v=4)[Twingly](/maintainers/twingly)[@twingly](https://github.com/twingly)

---

Top Contributors

[![roback](https://avatars.githubusercontent.com/u/2803721?v=4)](https://github.com/roback "roback (60 commits)")[![walro](https://avatars.githubusercontent.com/u/2550510?v=4)](https://github.com/walro "walro (25 commits)")[![r10v](https://avatars.githubusercontent.com/u/40642603?v=4)](https://github.com/r10v "r10v (12 commits)")[![dentarg](https://avatars.githubusercontent.com/u/42626?v=4)](https://github.com/dentarg "dentarg (5 commits)")[![kingjan1999](https://avatars.githubusercontent.com/u/3208269?v=4)](https://github.com/kingjan1999 "kingjan1999 (5 commits)")[![bearburger](https://avatars.githubusercontent.com/u/634114?v=4)](https://github.com/bearburger "bearburger (3 commits)")[![Pontus4](https://avatars.githubusercontent.com/u/16963686?v=4)](https://github.com/Pontus4 "Pontus4 (2 commits)")[![vikiv480](https://avatars.githubusercontent.com/u/21197532?v=4)](https://github.com/vikiv480 "vikiv480 (2 commits)")[![jage](https://avatars.githubusercontent.com/u/7913?v=4)](https://github.com/jage "jage (1 commits)")

---

Tags

blogsphpsearchsocial-mediaapitwinglytwingly.com

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/twingly-twingly-search/health.svg)

```
[![Health](https://phpackages.com/badges/twingly-twingly-search/health.svg)](https://phpackages.com/packages/twingly-twingly-search)
```

###  Alternatives

[tencentcloud/tencentcloud-sdk-php

TencentCloudApi php sdk

3741.3M46](/packages/tencentcloud-tencentcloud-sdk-php)[resend/resend-php

Resend PHP library.

617.2M37](/packages/resend-resend-php)[files.com/files-php-sdk

Files.com PHP SDK

2481.1k](/packages/filescom-files-php-sdk)[checkout/checkout-sdk-php

Checkout.com SDK for PHP

563.6M13](/packages/checkout-checkout-sdk-php)[aimeos/prisma

A powerful PHP package for integrating media related Large Language Models (LLMs) into your applications

1933.1k4](/packages/aimeos-prisma)[eslazarev/wildberries-sdk

Wildberries OpenAPI clients (generated).

252.5k](/packages/eslazarev-wildberries-sdk)

PHPackages © 2026

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