PHPackages                             rafaelglikis/sinama - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. rafaelglikis/sinama

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

rafaelglikis/sinama
===================

Web scraping library

1.2(7y ago)316MITPHPPHP &gt;=7.0

Since Aug 15Pushed 7y ago1 watchersCompare

[ Source](https://github.com/rafaelglikis/sinama)[ Packagist](https://packagist.org/packages/rafaelglikis/sinama)[ Docs](https://github.com/rafaelglikis/sinama)[ RSS](/packages/rafaelglikis-sinama/feed)WikiDiscussions master Synced yesterday

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

Sinama
======

[](#sinama)

[![Build Status](https://camo.githubusercontent.com/2479e163b95aeb71d0dd6af6ae74f86a93c39ba1100a480b70f2d5daa6215fc6/68747470733a2f2f7472617669732d63692e6f72672f72616661656c676c696b69732f73696e616d612e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/rafaelglikis/sinama)

Sinama is a simple web scraping library.

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

[](#requirements)

- PHP 7.0

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

[](#installation)

```
composer require rafaelglikis/sinama
```

Usage
-----

[](#usage)

Create a Sinama Client (which extends Goutte\\Client):

```
use  Sinama\Client;
$client = new Client();
```

Make requests with the request() method:

```
// Go to the motherfuckingwebsite.com website
$crawler = $client->request('GET', 'https://motherfuckingwebsite.com/');
```

The method returns a Crawler object (which extends [Symfony/Component/DomCrawler/Crawler](https://api.symfony.com/4.1/Symfony/Component/DomCrawler/Crawler.html)).

To use your own Guzzle settings, you may create and pass a new Guzzle 6 instance to Sinama Client. For example, to add a 60 second request timeout:

```
use  Sinama\Client;
use GuzzleHttp\Client as GuzzleClient;

$client = new Client(new GuzzleClient([
    'timeout' => 60
]));
$crawler = $client->request('GET', 'https://github.com/trending');
```

For more options visit [Guzzle Documentation](http://docs.guzzlephp.org/en/stable/request-options.html).

Click on links:

```
$link = $crawler->selectLink('PHP')->link();
$crawler = $client->click($link);
echo $crawler->getUri()."\n";
```

Extract data the symfony way:

```
$crawler->filter('h3 > a')->each(function ($node) {
    print trim($node->text())."\n";
});
```

Or use Sinama special methods:

```
$crawler = $client->request('GET', 'https://github.com/trending');
echo '';
echo '';
echo ''.$crawler->findTitle().'';
echo '';
echo '';
echo ''.$crawler->findTitle().'';
echo 'Main Image: '.$crawler->findMainImage().'';
echo $crawler->findMainContent();
echo '';
echo 'Links: ';
print_r($crawler->findLinks());
echo 'Emails: ';
print_r($crawler->findEmails());
echo 'Images: ';
print_r($crawler->findImages());
echo '';
echo '';
echo '';
```

Submit forms:

```
$crawler = $client->request('GET', 'https://www.google.com/');
$form = $crawler->selectButton('Google Search')->form();
$crawler = $client->submit($form, ['q' => 'rafaelglikis/sinama']);
$crawler->filter('h3 > a')->each(function ($node) {
    print trim($node->text())."\n";
});
```

Now that we have learned enough let's scrape a site with Sinama Spider:

```
use Sinama\Crawler;
use Sinama\Spider as BaseSpider;

class Spider extends BaseSpider
{
    public function parse(Crawler $crawler)
    {
        $crawler->filter('div.read-more > a')->each(function (Crawler $node) {
            $this->scrape($node->attr('href'));
        });

        $crawler->filter('div.blog-pagination > a')->each(function ($node) {
            $this->follow($node->attr('href'));
        });
    }

    public function scrape($url)
    {
        echo "*************************************************** ".$url."\n";
        $crawler = $this->client->request('GET', $url);
        echo "Title: " . $crawler->findTitle() . "\n";
        echo "Main Image: " . $crawler->findMainImage()."\n";
        echo "Main Content: \n" . $crawler->findMainContent()."\n";
        echo "Emails: \n";
        print_r($crawler->findEmails());
        echo "Links: \n";
        print_r($crawler->findLinks());
    }

    public function getStartUrls(): array
    {
        return [
            'https://blog.scrapinghub.com'
        ];
    }
}

$spider = new Spider([
    'start_urls' => [ 'https://blog.scrapinghub.com' ],
    'max_depth' => 2,
    'verbose' => true
]);
$spider->run();
```

TODO
----

[](#todo)

- Crawler::findTags()

###  Health Score

27

—

LowBetter than 47% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity61

Established project with proven stability

 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 ~0 days

Total

4

Last Release

2875d ago

Major Versions

0.0.2 → 1.02018-08-16

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/4549981?v=4)[Rafael Glikis](/maintainers/rafaelglikis)[@rafaelglikis](https://github.com/rafaelglikis)

---

Top Contributors

[![rafaelglikis](https://avatars.githubusercontent.com/u/4549981?v=4)](https://github.com/rafaelglikis "rafaelglikis (38 commits)")

---

Tags

crawlercrawlingscraperscrapingcrawlerscrapercrawlingscraping

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/rafaelglikis-sinama/health.svg)

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

###  Alternatives

[crwlr/crawler

Web crawling and scraping library.

36816.4k2](/packages/crwlr-crawler)[vdb/php-spider

A configurable and extensible PHP web spider

1.3k184.2k7](/packages/vdb-php-spider)[blackfire/player

A powerful web crawler and web scraper with Blackfire support

49517.1k](/packages/blackfire-player)[duzun/hquery

An extremely fast web scraper that parses megabytes of HTML in a blink of an eye. No dependencies. PHP5+

361159.6k5](/packages/duzun-hquery)[crawlbase/crawlbase

A lightweight, dependency free PHP class that acts as wrapper for Crawlbase API

1656.4k](/packages/crawlbase-crawlbase)[eddieace/php-simple

1363.7k](/packages/eddieace-php-simple)

PHPackages © 2026

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