├── .gitignore ├── .travis.yml ├── LICENSE ├── README.md ├── composer.json ├── composer.lock ├── examples ├── getProfile.php └── getTweets.php └── src ├── Models ├── Account.php ├── ModelAbstract.php ├── ModelInterface.php └── Tweet.php ├── Traits ├── ArrayLikeTrait.php └── HelpersTrait.php ├── Twitter.php └── TwitterAbstract.php /.gitignore: -------------------------------------------------------------------------------- 1 | /vendor 2 | /.idea 3 | /.vscode 4 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: php 2 | 3 | php: 4 | - 7.1 5 | - 7.2 6 | - 7.3 7 | 8 | before_script: 9 | - travis_retry composer self-update 10 | - travis_retry composer install --prefer-source --no-interaction --dev 11 | 12 | script: '' 13 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 Gustavo Bissolli 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Twitter Profile Scraper 2 | 3 | [![Build Status](https://travis-ci.org/bissolli/twitter-php-scraper.svg?branch=master)](https://travis-ci.org/bissolli/twitter-php-scraper) 4 | [![Latest Stable Version](https://poser.pugx.org/bissolli/twitter-php-scraper/v/stable)](https://packagist.org/packages/bissolli/twitter-php-scraper) 5 | [![Total Downloads](https://poser.pugx.org/bissolli/twitter-php-scraper/downloads)](https://packagist.org/packages/bissolli/twitter-php-scraper) 6 | [![License](https://poser.pugx.org/bissolli/twitter-php-scraper/license)](https://packagist.org/packages/bissolli/twitter-php-scraper) 7 | 8 | Twitter PHP Scrapper. Get account information, tweets, likes, re-tweets and comments through the Twitter handle. 9 | 10 | ## Code Example 11 | To get the user profile: 12 | ```php 13 | $twitter = new \Bissolli\TwitterScraper\Twitter('official_php'); 14 | var_dump($twitter->getProfile()); 15 | ``` 16 | To load all the reachable tweets (last 20 tweets) 17 | ```php 18 | $twitter = (new \Bissolli\TwitterScraper\Twitter('official_php'))->loadTweets(); 19 | var_dump($twitter->getProfile()); 20 | var_dump($twitter->getTweets()); 21 | ``` 22 | 23 | ## Installation 24 | 25 | ### Using composer 26 | ```sh 27 | composer require bissolli/twitter-php-scraper 28 | ``` 29 | 30 | ### If you don't have composer 31 | You can download it [here](https://getcomposer.org/download/). 32 | 33 | # TODO 34 | * [X] Implement .travis.yml 35 | -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "bissolli/twitter-php-scraper", 3 | "description": "Twitter PHP Scraper. Get account information, tweets, likes, re-tweets and comments.", 4 | "keywords": [ "twitter", "profile", "tweets", "scraper", "laravel" ], 5 | "type": "library", 6 | "homepage": "https://github.com/bissolli/twitter-php-scraper", 7 | "license": "MIT", 8 | "authors": [ 9 | { 10 | "name": "Gustavo Bissolli", 11 | "email": "gustavo.bissolli@gmail.com" 12 | } 13 | ], 14 | "require": { 15 | "php": ">=7.1.0", 16 | "nesbot/carbon": "~1.32", 17 | "paquettg/php-html-parser": "^2.0" 18 | }, 19 | "require-dev": { 20 | "phpunit/phpunit": "~5.5" 21 | }, 22 | "autoload": { 23 | "psr-4": { 24 | "Bissolli\\TwitterScraper\\": "src/" 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /composer.lock: -------------------------------------------------------------------------------- 1 | { 2 | "_readme": [ 3 | "This file locks the dependencies of your project to a known state", 4 | "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", 5 | "This file is @generated automatically" 6 | ], 7 | "content-hash": "14ce7f660eee1d6bf04b3fc282fcc274", 8 | "packages": [ 9 | { 10 | "name": "nesbot/carbon", 11 | "version": "1.33.0", 12 | "source": { 13 | "type": "git", 14 | "url": "https://github.com/briannesbitt/Carbon.git", 15 | "reference": "55667c1007a99e82030874b1bb14d24d07108413" 16 | }, 17 | "dist": { 18 | "type": "zip", 19 | "url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/55667c1007a99e82030874b1bb14d24d07108413", 20 | "reference": "55667c1007a99e82030874b1bb14d24d07108413", 21 | "shasum": "" 22 | }, 23 | "require": { 24 | "php": ">=5.3.9", 25 | "symfony/translation": "~2.6 || ~3.0 || ~4.0" 26 | }, 27 | "require-dev": { 28 | "friendsofphp/php-cs-fixer": "~2", 29 | "phpunit/phpunit": "^4.8.35 || ^5.7" 30 | }, 31 | "type": "library", 32 | "extra": { 33 | "laravel": { 34 | "providers": [ 35 | "Carbon\\Laravel\\ServiceProvider" 36 | ] 37 | } 38 | }, 39 | "autoload": { 40 | "psr-4": { 41 | "": "src/" 42 | } 43 | }, 44 | "notification-url": "https://packagist.org/downloads/", 45 | "license": [ 46 | "MIT" 47 | ], 48 | "authors": [ 49 | { 50 | "name": "Brian Nesbitt", 51 | "email": "brian@nesbot.com", 52 | "homepage": "http://nesbot.com" 53 | } 54 | ], 55 | "description": "A simple API extension for DateTime.", 56 | "homepage": "http://carbon.nesbot.com", 57 | "keywords": [ 58 | "date", 59 | "datetime", 60 | "time" 61 | ], 62 | "time": "2018-08-07T08:39:47+00:00" 63 | }, 64 | { 65 | "name": "paquettg/php-html-parser", 66 | "version": "2.0.2", 67 | "source": { 68 | "type": "git", 69 | "url": "https://github.com/paquettg/php-html-parser.git", 70 | "reference": "77e4a44b0916690b4300fe9abf98fd05bbba48f0" 71 | }, 72 | "dist": { 73 | "type": "zip", 74 | "url": "https://api.github.com/repos/paquettg/php-html-parser/zipball/77e4a44b0916690b4300fe9abf98fd05bbba48f0", 75 | "reference": "77e4a44b0916690b4300fe9abf98fd05bbba48f0", 76 | "shasum": "" 77 | }, 78 | "require": { 79 | "ext-mbstring": "*", 80 | "paquettg/string-encode": "~1.0.0", 81 | "php": ">=7.1" 82 | }, 83 | "require-dev": { 84 | "mockery/mockery": "^1.2", 85 | "php-coveralls/php-coveralls": "^2.1", 86 | "phpunit/phpunit": "^7.5.1" 87 | }, 88 | "type": "library", 89 | "autoload": { 90 | "psr-0": { 91 | "PHPHtmlParser": "src/" 92 | } 93 | }, 94 | "notification-url": "https://packagist.org/downloads/", 95 | "license": [ 96 | "MIT" 97 | ], 98 | "authors": [ 99 | { 100 | "name": "Gilles Paquette", 101 | "email": "paquettg@gmail.com", 102 | "homepage": "http://gillespaquette.ca" 103 | } 104 | ], 105 | "description": "An HTML DOM parser. It allows you to manipulate HTML. Find tags on an HTML page with selectors just like jQuery.", 106 | "homepage": "https://github.com/paquettg/php-html-parser", 107 | "keywords": [ 108 | "dom", 109 | "html", 110 | "parser" 111 | ], 112 | "time": "2019-02-10T01:35:49+00:00" 113 | }, 114 | { 115 | "name": "paquettg/string-encode", 116 | "version": "1.0.1", 117 | "source": { 118 | "type": "git", 119 | "url": "https://github.com/paquettg/string-encoder.git", 120 | "reference": "a8708e9fac9d5ddfc8fc2aac6004e2cd05d80fee" 121 | }, 122 | "dist": { 123 | "type": "zip", 124 | "url": "https://api.github.com/repos/paquettg/string-encoder/zipball/a8708e9fac9d5ddfc8fc2aac6004e2cd05d80fee", 125 | "reference": "a8708e9fac9d5ddfc8fc2aac6004e2cd05d80fee", 126 | "shasum": "" 127 | }, 128 | "require": { 129 | "php": ">=7.1" 130 | }, 131 | "require-dev": { 132 | "phpunit/phpunit": "^7.5.1" 133 | }, 134 | "type": "library", 135 | "autoload": { 136 | "psr-0": { 137 | "stringEncode": "src/" 138 | } 139 | }, 140 | "notification-url": "https://packagist.org/downloads/", 141 | "license": [ 142 | "MIT" 143 | ], 144 | "authors": [ 145 | { 146 | "name": "Gilles Paquette", 147 | "email": "paquettg@gmail.com", 148 | "homepage": "http://gillespaquette.ca" 149 | } 150 | ], 151 | "description": "Facilitating the process of altering string encoding in PHP.", 152 | "homepage": "https://github.com/paquettg/string-encoder", 153 | "keywords": [ 154 | "charset", 155 | "encoding", 156 | "string" 157 | ], 158 | "time": "2018-12-21T02:25:09+00:00" 159 | }, 160 | { 161 | "name": "symfony/polyfill-mbstring", 162 | "version": "v1.9.0", 163 | "source": { 164 | "type": "git", 165 | "url": "https://github.com/symfony/polyfill-mbstring.git", 166 | "reference": "d0cd638f4634c16d8df4508e847f14e9e43168b8" 167 | }, 168 | "dist": { 169 | "type": "zip", 170 | "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/d0cd638f4634c16d8df4508e847f14e9e43168b8", 171 | "reference": "d0cd638f4634c16d8df4508e847f14e9e43168b8", 172 | "shasum": "" 173 | }, 174 | "require": { 175 | "php": ">=5.3.3" 176 | }, 177 | "suggest": { 178 | "ext-mbstring": "For best performance" 179 | }, 180 | "type": "library", 181 | "extra": { 182 | "branch-alias": { 183 | "dev-master": "1.9-dev" 184 | } 185 | }, 186 | "autoload": { 187 | "psr-4": { 188 | "Symfony\\Polyfill\\Mbstring\\": "" 189 | }, 190 | "files": [ 191 | "bootstrap.php" 192 | ] 193 | }, 194 | "notification-url": "https://packagist.org/downloads/", 195 | "license": [ 196 | "MIT" 197 | ], 198 | "authors": [ 199 | { 200 | "name": "Nicolas Grekas", 201 | "email": "p@tchwork.com" 202 | }, 203 | { 204 | "name": "Symfony Community", 205 | "homepage": "https://symfony.com/contributors" 206 | } 207 | ], 208 | "description": "Symfony polyfill for the Mbstring extension", 209 | "homepage": "https://symfony.com", 210 | "keywords": [ 211 | "compatibility", 212 | "mbstring", 213 | "polyfill", 214 | "portable", 215 | "shim" 216 | ], 217 | "time": "2018-08-06T14:22:27+00:00" 218 | }, 219 | { 220 | "name": "symfony/translation", 221 | "version": "v4.1.3", 222 | "source": { 223 | "type": "git", 224 | "url": "https://github.com/symfony/translation.git", 225 | "reference": "6fcd1bd44fd6d7181e6ea57a6f4e08a09b29ef65" 226 | }, 227 | "dist": { 228 | "type": "zip", 229 | "url": "https://api.github.com/repos/symfony/translation/zipball/6fcd1bd44fd6d7181e6ea57a6f4e08a09b29ef65", 230 | "reference": "6fcd1bd44fd6d7181e6ea57a6f4e08a09b29ef65", 231 | "shasum": "" 232 | }, 233 | "require": { 234 | "php": "^7.1.3", 235 | "symfony/polyfill-mbstring": "~1.0" 236 | }, 237 | "conflict": { 238 | "symfony/config": "<3.4", 239 | "symfony/dependency-injection": "<3.4", 240 | "symfony/yaml": "<3.4" 241 | }, 242 | "require-dev": { 243 | "psr/log": "~1.0", 244 | "symfony/config": "~3.4|~4.0", 245 | "symfony/console": "~3.4|~4.0", 246 | "symfony/dependency-injection": "~3.4|~4.0", 247 | "symfony/finder": "~2.8|~3.0|~4.0", 248 | "symfony/intl": "~3.4|~4.0", 249 | "symfony/yaml": "~3.4|~4.0" 250 | }, 251 | "suggest": { 252 | "psr/log-implementation": "To use logging capability in translator", 253 | "symfony/config": "", 254 | "symfony/yaml": "" 255 | }, 256 | "type": "library", 257 | "extra": { 258 | "branch-alias": { 259 | "dev-master": "4.1-dev" 260 | } 261 | }, 262 | "autoload": { 263 | "psr-4": { 264 | "Symfony\\Component\\Translation\\": "" 265 | }, 266 | "exclude-from-classmap": [ 267 | "/Tests/" 268 | ] 269 | }, 270 | "notification-url": "https://packagist.org/downloads/", 271 | "license": [ 272 | "MIT" 273 | ], 274 | "authors": [ 275 | { 276 | "name": "Fabien Potencier", 277 | "email": "fabien@symfony.com" 278 | }, 279 | { 280 | "name": "Symfony Community", 281 | "homepage": "https://symfony.com/contributors" 282 | } 283 | ], 284 | "description": "Symfony Translation Component", 285 | "homepage": "https://symfony.com", 286 | "time": "2018-07-26T11:24:31+00:00" 287 | } 288 | ], 289 | "packages-dev": [ 290 | { 291 | "name": "doctrine/instantiator", 292 | "version": "1.1.0", 293 | "source": { 294 | "type": "git", 295 | "url": "https://github.com/doctrine/instantiator.git", 296 | "reference": "185b8868aa9bf7159f5f953ed5afb2d7fcdc3bda" 297 | }, 298 | "dist": { 299 | "type": "zip", 300 | "url": "https://api.github.com/repos/doctrine/instantiator/zipball/185b8868aa9bf7159f5f953ed5afb2d7fcdc3bda", 301 | "reference": "185b8868aa9bf7159f5f953ed5afb2d7fcdc3bda", 302 | "shasum": "" 303 | }, 304 | "require": { 305 | "php": "^7.1" 306 | }, 307 | "require-dev": { 308 | "athletic/athletic": "~0.1.8", 309 | "ext-pdo": "*", 310 | "ext-phar": "*", 311 | "phpunit/phpunit": "^6.2.3", 312 | "squizlabs/php_codesniffer": "^3.0.2" 313 | }, 314 | "type": "library", 315 | "extra": { 316 | "branch-alias": { 317 | "dev-master": "1.2.x-dev" 318 | } 319 | }, 320 | "autoload": { 321 | "psr-4": { 322 | "Doctrine\\Instantiator\\": "src/Doctrine/Instantiator/" 323 | } 324 | }, 325 | "notification-url": "https://packagist.org/downloads/", 326 | "license": [ 327 | "MIT" 328 | ], 329 | "authors": [ 330 | { 331 | "name": "Marco Pivetta", 332 | "email": "ocramius@gmail.com", 333 | "homepage": "http://ocramius.github.com/" 334 | } 335 | ], 336 | "description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors", 337 | "homepage": "https://github.com/doctrine/instantiator", 338 | "keywords": [ 339 | "constructor", 340 | "instantiate" 341 | ], 342 | "time": "2017-07-22T11:58:36+00:00" 343 | }, 344 | { 345 | "name": "myclabs/deep-copy", 346 | "version": "1.8.1", 347 | "source": { 348 | "type": "git", 349 | "url": "https://github.com/myclabs/DeepCopy.git", 350 | "reference": "3e01bdad3e18354c3dce54466b7fbe33a9f9f7f8" 351 | }, 352 | "dist": { 353 | "type": "zip", 354 | "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/3e01bdad3e18354c3dce54466b7fbe33a9f9f7f8", 355 | "reference": "3e01bdad3e18354c3dce54466b7fbe33a9f9f7f8", 356 | "shasum": "" 357 | }, 358 | "require": { 359 | "php": "^7.1" 360 | }, 361 | "replace": { 362 | "myclabs/deep-copy": "self.version" 363 | }, 364 | "require-dev": { 365 | "doctrine/collections": "^1.0", 366 | "doctrine/common": "^2.6", 367 | "phpunit/phpunit": "^7.1" 368 | }, 369 | "type": "library", 370 | "autoload": { 371 | "psr-4": { 372 | "DeepCopy\\": "src/DeepCopy/" 373 | }, 374 | "files": [ 375 | "src/DeepCopy/deep_copy.php" 376 | ] 377 | }, 378 | "notification-url": "https://packagist.org/downloads/", 379 | "license": [ 380 | "MIT" 381 | ], 382 | "description": "Create deep copies (clones) of your objects", 383 | "keywords": [ 384 | "clone", 385 | "copy", 386 | "duplicate", 387 | "object", 388 | "object graph" 389 | ], 390 | "time": "2018-06-11T23:09:50+00:00" 391 | }, 392 | { 393 | "name": "phpdocumentor/reflection-common", 394 | "version": "1.0.1", 395 | "source": { 396 | "type": "git", 397 | "url": "https://github.com/phpDocumentor/ReflectionCommon.git", 398 | "reference": "21bdeb5f65d7ebf9f43b1b25d404f87deab5bfb6" 399 | }, 400 | "dist": { 401 | "type": "zip", 402 | "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/21bdeb5f65d7ebf9f43b1b25d404f87deab5bfb6", 403 | "reference": "21bdeb5f65d7ebf9f43b1b25d404f87deab5bfb6", 404 | "shasum": "" 405 | }, 406 | "require": { 407 | "php": ">=5.5" 408 | }, 409 | "require-dev": { 410 | "phpunit/phpunit": "^4.6" 411 | }, 412 | "type": "library", 413 | "extra": { 414 | "branch-alias": { 415 | "dev-master": "1.0.x-dev" 416 | } 417 | }, 418 | "autoload": { 419 | "psr-4": { 420 | "phpDocumentor\\Reflection\\": [ 421 | "src" 422 | ] 423 | } 424 | }, 425 | "notification-url": "https://packagist.org/downloads/", 426 | "license": [ 427 | "MIT" 428 | ], 429 | "authors": [ 430 | { 431 | "name": "Jaap van Otterdijk", 432 | "email": "opensource@ijaap.nl" 433 | } 434 | ], 435 | "description": "Common reflection classes used by phpdocumentor to reflect the code structure", 436 | "homepage": "http://www.phpdoc.org", 437 | "keywords": [ 438 | "FQSEN", 439 | "phpDocumentor", 440 | "phpdoc", 441 | "reflection", 442 | "static analysis" 443 | ], 444 | "time": "2017-09-11T18:02:19+00:00" 445 | }, 446 | { 447 | "name": "phpdocumentor/reflection-docblock", 448 | "version": "4.3.0", 449 | "source": { 450 | "type": "git", 451 | "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", 452 | "reference": "94fd0001232e47129dd3504189fa1c7225010d08" 453 | }, 454 | "dist": { 455 | "type": "zip", 456 | "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/94fd0001232e47129dd3504189fa1c7225010d08", 457 | "reference": "94fd0001232e47129dd3504189fa1c7225010d08", 458 | "shasum": "" 459 | }, 460 | "require": { 461 | "php": "^7.0", 462 | "phpdocumentor/reflection-common": "^1.0.0", 463 | "phpdocumentor/type-resolver": "^0.4.0", 464 | "webmozart/assert": "^1.0" 465 | }, 466 | "require-dev": { 467 | "doctrine/instantiator": "~1.0.5", 468 | "mockery/mockery": "^1.0", 469 | "phpunit/phpunit": "^6.4" 470 | }, 471 | "type": "library", 472 | "extra": { 473 | "branch-alias": { 474 | "dev-master": "4.x-dev" 475 | } 476 | }, 477 | "autoload": { 478 | "psr-4": { 479 | "phpDocumentor\\Reflection\\": [ 480 | "src/" 481 | ] 482 | } 483 | }, 484 | "notification-url": "https://packagist.org/downloads/", 485 | "license": [ 486 | "MIT" 487 | ], 488 | "authors": [ 489 | { 490 | "name": "Mike van Riel", 491 | "email": "me@mikevanriel.com" 492 | } 493 | ], 494 | "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", 495 | "time": "2017-11-30T07:14:17+00:00" 496 | }, 497 | { 498 | "name": "phpdocumentor/type-resolver", 499 | "version": "0.4.0", 500 | "source": { 501 | "type": "git", 502 | "url": "https://github.com/phpDocumentor/TypeResolver.git", 503 | "reference": "9c977708995954784726e25d0cd1dddf4e65b0f7" 504 | }, 505 | "dist": { 506 | "type": "zip", 507 | "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/9c977708995954784726e25d0cd1dddf4e65b0f7", 508 | "reference": "9c977708995954784726e25d0cd1dddf4e65b0f7", 509 | "shasum": "" 510 | }, 511 | "require": { 512 | "php": "^5.5 || ^7.0", 513 | "phpdocumentor/reflection-common": "^1.0" 514 | }, 515 | "require-dev": { 516 | "mockery/mockery": "^0.9.4", 517 | "phpunit/phpunit": "^5.2||^4.8.24" 518 | }, 519 | "type": "library", 520 | "extra": { 521 | "branch-alias": { 522 | "dev-master": "1.0.x-dev" 523 | } 524 | }, 525 | "autoload": { 526 | "psr-4": { 527 | "phpDocumentor\\Reflection\\": [ 528 | "src/" 529 | ] 530 | } 531 | }, 532 | "notification-url": "https://packagist.org/downloads/", 533 | "license": [ 534 | "MIT" 535 | ], 536 | "authors": [ 537 | { 538 | "name": "Mike van Riel", 539 | "email": "me@mikevanriel.com" 540 | } 541 | ], 542 | "time": "2017-07-14T14:27:02+00:00" 543 | }, 544 | { 545 | "name": "phpspec/prophecy", 546 | "version": "1.8.0", 547 | "source": { 548 | "type": "git", 549 | "url": "https://github.com/phpspec/prophecy.git", 550 | "reference": "4ba436b55987b4bf311cb7c6ba82aa528aac0a06" 551 | }, 552 | "dist": { 553 | "type": "zip", 554 | "url": "https://api.github.com/repos/phpspec/prophecy/zipball/4ba436b55987b4bf311cb7c6ba82aa528aac0a06", 555 | "reference": "4ba436b55987b4bf311cb7c6ba82aa528aac0a06", 556 | "shasum": "" 557 | }, 558 | "require": { 559 | "doctrine/instantiator": "^1.0.2", 560 | "php": "^5.3|^7.0", 561 | "phpdocumentor/reflection-docblock": "^2.0|^3.0.2|^4.0", 562 | "sebastian/comparator": "^1.1|^2.0|^3.0", 563 | "sebastian/recursion-context": "^1.0|^2.0|^3.0" 564 | }, 565 | "require-dev": { 566 | "phpspec/phpspec": "^2.5|^3.2", 567 | "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.5 || ^7.1" 568 | }, 569 | "type": "library", 570 | "extra": { 571 | "branch-alias": { 572 | "dev-master": "1.8.x-dev" 573 | } 574 | }, 575 | "autoload": { 576 | "psr-0": { 577 | "Prophecy\\": "src/" 578 | } 579 | }, 580 | "notification-url": "https://packagist.org/downloads/", 581 | "license": [ 582 | "MIT" 583 | ], 584 | "authors": [ 585 | { 586 | "name": "Konstantin Kudryashov", 587 | "email": "ever.zet@gmail.com", 588 | "homepage": "http://everzet.com" 589 | }, 590 | { 591 | "name": "Marcello Duarte", 592 | "email": "marcello.duarte@gmail.com" 593 | } 594 | ], 595 | "description": "Highly opinionated mocking framework for PHP 5.3+", 596 | "homepage": "https://github.com/phpspec/prophecy", 597 | "keywords": [ 598 | "Double", 599 | "Dummy", 600 | "fake", 601 | "mock", 602 | "spy", 603 | "stub" 604 | ], 605 | "time": "2018-08-05T17:53:17+00:00" 606 | }, 607 | { 608 | "name": "phpunit/php-code-coverage", 609 | "version": "4.0.8", 610 | "source": { 611 | "type": "git", 612 | "url": "https://github.com/sebastianbergmann/php-code-coverage.git", 613 | "reference": "ef7b2f56815df854e66ceaee8ebe9393ae36a40d" 614 | }, 615 | "dist": { 616 | "type": "zip", 617 | "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/ef7b2f56815df854e66ceaee8ebe9393ae36a40d", 618 | "reference": "ef7b2f56815df854e66ceaee8ebe9393ae36a40d", 619 | "shasum": "" 620 | }, 621 | "require": { 622 | "ext-dom": "*", 623 | "ext-xmlwriter": "*", 624 | "php": "^5.6 || ^7.0", 625 | "phpunit/php-file-iterator": "^1.3", 626 | "phpunit/php-text-template": "^1.2", 627 | "phpunit/php-token-stream": "^1.4.2 || ^2.0", 628 | "sebastian/code-unit-reverse-lookup": "^1.0", 629 | "sebastian/environment": "^1.3.2 || ^2.0", 630 | "sebastian/version": "^1.0 || ^2.0" 631 | }, 632 | "require-dev": { 633 | "ext-xdebug": "^2.1.4", 634 | "phpunit/phpunit": "^5.7" 635 | }, 636 | "suggest": { 637 | "ext-xdebug": "^2.5.1" 638 | }, 639 | "type": "library", 640 | "extra": { 641 | "branch-alias": { 642 | "dev-master": "4.0.x-dev" 643 | } 644 | }, 645 | "autoload": { 646 | "classmap": [ 647 | "src/" 648 | ] 649 | }, 650 | "notification-url": "https://packagist.org/downloads/", 651 | "license": [ 652 | "BSD-3-Clause" 653 | ], 654 | "authors": [ 655 | { 656 | "name": "Sebastian Bergmann", 657 | "email": "sb@sebastian-bergmann.de", 658 | "role": "lead" 659 | } 660 | ], 661 | "description": "Library that provides collection, processing, and rendering functionality for PHP code coverage information.", 662 | "homepage": "https://github.com/sebastianbergmann/php-code-coverage", 663 | "keywords": [ 664 | "coverage", 665 | "testing", 666 | "xunit" 667 | ], 668 | "time": "2017-04-02T07:44:40+00:00" 669 | }, 670 | { 671 | "name": "phpunit/php-file-iterator", 672 | "version": "1.4.5", 673 | "source": { 674 | "type": "git", 675 | "url": "https://github.com/sebastianbergmann/php-file-iterator.git", 676 | "reference": "730b01bc3e867237eaac355e06a36b85dd93a8b4" 677 | }, 678 | "dist": { 679 | "type": "zip", 680 | "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/730b01bc3e867237eaac355e06a36b85dd93a8b4", 681 | "reference": "730b01bc3e867237eaac355e06a36b85dd93a8b4", 682 | "shasum": "" 683 | }, 684 | "require": { 685 | "php": ">=5.3.3" 686 | }, 687 | "type": "library", 688 | "extra": { 689 | "branch-alias": { 690 | "dev-master": "1.4.x-dev" 691 | } 692 | }, 693 | "autoload": { 694 | "classmap": [ 695 | "src/" 696 | ] 697 | }, 698 | "notification-url": "https://packagist.org/downloads/", 699 | "license": [ 700 | "BSD-3-Clause" 701 | ], 702 | "authors": [ 703 | { 704 | "name": "Sebastian Bergmann", 705 | "email": "sb@sebastian-bergmann.de", 706 | "role": "lead" 707 | } 708 | ], 709 | "description": "FilterIterator implementation that filters files based on a list of suffixes.", 710 | "homepage": "https://github.com/sebastianbergmann/php-file-iterator/", 711 | "keywords": [ 712 | "filesystem", 713 | "iterator" 714 | ], 715 | "time": "2017-11-27T13:52:08+00:00" 716 | }, 717 | { 718 | "name": "phpunit/php-text-template", 719 | "version": "1.2.1", 720 | "source": { 721 | "type": "git", 722 | "url": "https://github.com/sebastianbergmann/php-text-template.git", 723 | "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686" 724 | }, 725 | "dist": { 726 | "type": "zip", 727 | "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/31f8b717e51d9a2afca6c9f046f5d69fc27c8686", 728 | "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686", 729 | "shasum": "" 730 | }, 731 | "require": { 732 | "php": ">=5.3.3" 733 | }, 734 | "type": "library", 735 | "autoload": { 736 | "classmap": [ 737 | "src/" 738 | ] 739 | }, 740 | "notification-url": "https://packagist.org/downloads/", 741 | "license": [ 742 | "BSD-3-Clause" 743 | ], 744 | "authors": [ 745 | { 746 | "name": "Sebastian Bergmann", 747 | "email": "sebastian@phpunit.de", 748 | "role": "lead" 749 | } 750 | ], 751 | "description": "Simple template engine.", 752 | "homepage": "https://github.com/sebastianbergmann/php-text-template/", 753 | "keywords": [ 754 | "template" 755 | ], 756 | "time": "2015-06-21T13:50:34+00:00" 757 | }, 758 | { 759 | "name": "phpunit/php-timer", 760 | "version": "1.0.9", 761 | "source": { 762 | "type": "git", 763 | "url": "https://github.com/sebastianbergmann/php-timer.git", 764 | "reference": "3dcf38ca72b158baf0bc245e9184d3fdffa9c46f" 765 | }, 766 | "dist": { 767 | "type": "zip", 768 | "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/3dcf38ca72b158baf0bc245e9184d3fdffa9c46f", 769 | "reference": "3dcf38ca72b158baf0bc245e9184d3fdffa9c46f", 770 | "shasum": "" 771 | }, 772 | "require": { 773 | "php": "^5.3.3 || ^7.0" 774 | }, 775 | "require-dev": { 776 | "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.0" 777 | }, 778 | "type": "library", 779 | "extra": { 780 | "branch-alias": { 781 | "dev-master": "1.0-dev" 782 | } 783 | }, 784 | "autoload": { 785 | "classmap": [ 786 | "src/" 787 | ] 788 | }, 789 | "notification-url": "https://packagist.org/downloads/", 790 | "license": [ 791 | "BSD-3-Clause" 792 | ], 793 | "authors": [ 794 | { 795 | "name": "Sebastian Bergmann", 796 | "email": "sb@sebastian-bergmann.de", 797 | "role": "lead" 798 | } 799 | ], 800 | "description": "Utility class for timing", 801 | "homepage": "https://github.com/sebastianbergmann/php-timer/", 802 | "keywords": [ 803 | "timer" 804 | ], 805 | "time": "2017-02-26T11:10:40+00:00" 806 | }, 807 | { 808 | "name": "phpunit/php-token-stream", 809 | "version": "2.0.2", 810 | "source": { 811 | "type": "git", 812 | "url": "https://github.com/sebastianbergmann/php-token-stream.git", 813 | "reference": "791198a2c6254db10131eecfe8c06670700904db" 814 | }, 815 | "dist": { 816 | "type": "zip", 817 | "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/791198a2c6254db10131eecfe8c06670700904db", 818 | "reference": "791198a2c6254db10131eecfe8c06670700904db", 819 | "shasum": "" 820 | }, 821 | "require": { 822 | "ext-tokenizer": "*", 823 | "php": "^7.0" 824 | }, 825 | "require-dev": { 826 | "phpunit/phpunit": "^6.2.4" 827 | }, 828 | "type": "library", 829 | "extra": { 830 | "branch-alias": { 831 | "dev-master": "2.0-dev" 832 | } 833 | }, 834 | "autoload": { 835 | "classmap": [ 836 | "src/" 837 | ] 838 | }, 839 | "notification-url": "https://packagist.org/downloads/", 840 | "license": [ 841 | "BSD-3-Clause" 842 | ], 843 | "authors": [ 844 | { 845 | "name": "Sebastian Bergmann", 846 | "email": "sebastian@phpunit.de" 847 | } 848 | ], 849 | "description": "Wrapper around PHP's tokenizer extension.", 850 | "homepage": "https://github.com/sebastianbergmann/php-token-stream/", 851 | "keywords": [ 852 | "tokenizer" 853 | ], 854 | "time": "2017-11-27T05:48:46+00:00" 855 | }, 856 | { 857 | "name": "phpunit/phpunit", 858 | "version": "5.5.7", 859 | "source": { 860 | "type": "git", 861 | "url": "https://github.com/sebastianbergmann/phpunit.git", 862 | "reference": "3f67cee782c9abfaee5e32fd2f57cdd54bc257ba" 863 | }, 864 | "dist": { 865 | "type": "zip", 866 | "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/3f67cee782c9abfaee5e32fd2f57cdd54bc257ba", 867 | "reference": "3f67cee782c9abfaee5e32fd2f57cdd54bc257ba", 868 | "shasum": "" 869 | }, 870 | "require": { 871 | "ext-dom": "*", 872 | "ext-json": "*", 873 | "ext-libxml": "*", 874 | "ext-mbstring": "*", 875 | "ext-xml": "*", 876 | "myclabs/deep-copy": "~1.3", 877 | "php": "^5.6 || ^7.0", 878 | "phpspec/prophecy": "^1.3.1", 879 | "phpunit/php-code-coverage": "^4.0.1", 880 | "phpunit/php-file-iterator": "~1.4", 881 | "phpunit/php-text-template": "~1.2", 882 | "phpunit/php-timer": "^1.0.6", 883 | "phpunit/phpunit-mock-objects": "^3.2", 884 | "sebastian/comparator": "~1.1", 885 | "sebastian/diff": "~1.2", 886 | "sebastian/environment": "^1.3 || ^2.0", 887 | "sebastian/exporter": "~1.2", 888 | "sebastian/global-state": "~1.0", 889 | "sebastian/object-enumerator": "~1.0", 890 | "sebastian/resource-operations": "~1.0", 891 | "sebastian/version": "~1.0|~2.0", 892 | "symfony/yaml": "~2.1|~3.0" 893 | }, 894 | "conflict": { 895 | "phpdocumentor/reflection-docblock": "3.0.2" 896 | }, 897 | "require-dev": { 898 | "ext-pdo": "*" 899 | }, 900 | "suggest": { 901 | "ext-tidy": "*", 902 | "ext-xdebug": "*", 903 | "phpunit/php-invoker": "~1.1" 904 | }, 905 | "bin": [ 906 | "phpunit" 907 | ], 908 | "type": "library", 909 | "extra": { 910 | "branch-alias": { 911 | "dev-master": "5.5.x-dev" 912 | } 913 | }, 914 | "autoload": { 915 | "classmap": [ 916 | "src/" 917 | ] 918 | }, 919 | "notification-url": "https://packagist.org/downloads/", 920 | "license": [ 921 | "BSD-3-Clause" 922 | ], 923 | "authors": [ 924 | { 925 | "name": "Sebastian Bergmann", 926 | "email": "sebastian@phpunit.de", 927 | "role": "lead" 928 | } 929 | ], 930 | "description": "The PHP Unit Testing framework.", 931 | "homepage": "https://phpunit.de/", 932 | "keywords": [ 933 | "phpunit", 934 | "testing", 935 | "xunit" 936 | ], 937 | "time": "2016-10-03T13:04:15+00:00" 938 | }, 939 | { 940 | "name": "phpunit/phpunit-mock-objects", 941 | "version": "3.4.4", 942 | "source": { 943 | "type": "git", 944 | "url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git", 945 | "reference": "a23b761686d50a560cc56233b9ecf49597cc9118" 946 | }, 947 | "dist": { 948 | "type": "zip", 949 | "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/a23b761686d50a560cc56233b9ecf49597cc9118", 950 | "reference": "a23b761686d50a560cc56233b9ecf49597cc9118", 951 | "shasum": "" 952 | }, 953 | "require": { 954 | "doctrine/instantiator": "^1.0.2", 955 | "php": "^5.6 || ^7.0", 956 | "phpunit/php-text-template": "^1.2", 957 | "sebastian/exporter": "^1.2 || ^2.0" 958 | }, 959 | "conflict": { 960 | "phpunit/phpunit": "<5.4.0" 961 | }, 962 | "require-dev": { 963 | "phpunit/phpunit": "^5.4" 964 | }, 965 | "suggest": { 966 | "ext-soap": "*" 967 | }, 968 | "type": "library", 969 | "extra": { 970 | "branch-alias": { 971 | "dev-master": "3.2.x-dev" 972 | } 973 | }, 974 | "autoload": { 975 | "classmap": [ 976 | "src/" 977 | ] 978 | }, 979 | "notification-url": "https://packagist.org/downloads/", 980 | "license": [ 981 | "BSD-3-Clause" 982 | ], 983 | "authors": [ 984 | { 985 | "name": "Sebastian Bergmann", 986 | "email": "sb@sebastian-bergmann.de", 987 | "role": "lead" 988 | } 989 | ], 990 | "description": "Mock Object library for PHPUnit", 991 | "homepage": "https://github.com/sebastianbergmann/phpunit-mock-objects/", 992 | "keywords": [ 993 | "mock", 994 | "xunit" 995 | ], 996 | "abandoned": true, 997 | "time": "2017-06-30T09:13:00+00:00" 998 | }, 999 | { 1000 | "name": "sebastian/code-unit-reverse-lookup", 1001 | "version": "1.0.1", 1002 | "source": { 1003 | "type": "git", 1004 | "url": "https://github.com/sebastianbergmann/code-unit-reverse-lookup.git", 1005 | "reference": "4419fcdb5eabb9caa61a27c7a1db532a6b55dd18" 1006 | }, 1007 | "dist": { 1008 | "type": "zip", 1009 | "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/4419fcdb5eabb9caa61a27c7a1db532a6b55dd18", 1010 | "reference": "4419fcdb5eabb9caa61a27c7a1db532a6b55dd18", 1011 | "shasum": "" 1012 | }, 1013 | "require": { 1014 | "php": "^5.6 || ^7.0" 1015 | }, 1016 | "require-dev": { 1017 | "phpunit/phpunit": "^5.7 || ^6.0" 1018 | }, 1019 | "type": "library", 1020 | "extra": { 1021 | "branch-alias": { 1022 | "dev-master": "1.0.x-dev" 1023 | } 1024 | }, 1025 | "autoload": { 1026 | "classmap": [ 1027 | "src/" 1028 | ] 1029 | }, 1030 | "notification-url": "https://packagist.org/downloads/", 1031 | "license": [ 1032 | "BSD-3-Clause" 1033 | ], 1034 | "authors": [ 1035 | { 1036 | "name": "Sebastian Bergmann", 1037 | "email": "sebastian@phpunit.de" 1038 | } 1039 | ], 1040 | "description": "Looks up which function or method a line of code belongs to", 1041 | "homepage": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/", 1042 | "time": "2017-03-04T06:30:41+00:00" 1043 | }, 1044 | { 1045 | "name": "sebastian/comparator", 1046 | "version": "1.2.4", 1047 | "source": { 1048 | "type": "git", 1049 | "url": "https://github.com/sebastianbergmann/comparator.git", 1050 | "reference": "2b7424b55f5047b47ac6e5ccb20b2aea4011d9be" 1051 | }, 1052 | "dist": { 1053 | "type": "zip", 1054 | "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/2b7424b55f5047b47ac6e5ccb20b2aea4011d9be", 1055 | "reference": "2b7424b55f5047b47ac6e5ccb20b2aea4011d9be", 1056 | "shasum": "" 1057 | }, 1058 | "require": { 1059 | "php": ">=5.3.3", 1060 | "sebastian/diff": "~1.2", 1061 | "sebastian/exporter": "~1.2 || ~2.0" 1062 | }, 1063 | "require-dev": { 1064 | "phpunit/phpunit": "~4.4" 1065 | }, 1066 | "type": "library", 1067 | "extra": { 1068 | "branch-alias": { 1069 | "dev-master": "1.2.x-dev" 1070 | } 1071 | }, 1072 | "autoload": { 1073 | "classmap": [ 1074 | "src/" 1075 | ] 1076 | }, 1077 | "notification-url": "https://packagist.org/downloads/", 1078 | "license": [ 1079 | "BSD-3-Clause" 1080 | ], 1081 | "authors": [ 1082 | { 1083 | "name": "Jeff Welch", 1084 | "email": "whatthejeff@gmail.com" 1085 | }, 1086 | { 1087 | "name": "Volker Dusch", 1088 | "email": "github@wallbash.com" 1089 | }, 1090 | { 1091 | "name": "Bernhard Schussek", 1092 | "email": "bschussek@2bepublished.at" 1093 | }, 1094 | { 1095 | "name": "Sebastian Bergmann", 1096 | "email": "sebastian@phpunit.de" 1097 | } 1098 | ], 1099 | "description": "Provides the functionality to compare PHP values for equality", 1100 | "homepage": "http://www.github.com/sebastianbergmann/comparator", 1101 | "keywords": [ 1102 | "comparator", 1103 | "compare", 1104 | "equality" 1105 | ], 1106 | "time": "2017-01-29T09:50:25+00:00" 1107 | }, 1108 | { 1109 | "name": "sebastian/diff", 1110 | "version": "1.4.3", 1111 | "source": { 1112 | "type": "git", 1113 | "url": "https://github.com/sebastianbergmann/diff.git", 1114 | "reference": "7f066a26a962dbe58ddea9f72a4e82874a3975a4" 1115 | }, 1116 | "dist": { 1117 | "type": "zip", 1118 | "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/7f066a26a962dbe58ddea9f72a4e82874a3975a4", 1119 | "reference": "7f066a26a962dbe58ddea9f72a4e82874a3975a4", 1120 | "shasum": "" 1121 | }, 1122 | "require": { 1123 | "php": "^5.3.3 || ^7.0" 1124 | }, 1125 | "require-dev": { 1126 | "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.0" 1127 | }, 1128 | "type": "library", 1129 | "extra": { 1130 | "branch-alias": { 1131 | "dev-master": "1.4-dev" 1132 | } 1133 | }, 1134 | "autoload": { 1135 | "classmap": [ 1136 | "src/" 1137 | ] 1138 | }, 1139 | "notification-url": "https://packagist.org/downloads/", 1140 | "license": [ 1141 | "BSD-3-Clause" 1142 | ], 1143 | "authors": [ 1144 | { 1145 | "name": "Kore Nordmann", 1146 | "email": "mail@kore-nordmann.de" 1147 | }, 1148 | { 1149 | "name": "Sebastian Bergmann", 1150 | "email": "sebastian@phpunit.de" 1151 | } 1152 | ], 1153 | "description": "Diff implementation", 1154 | "homepage": "https://github.com/sebastianbergmann/diff", 1155 | "keywords": [ 1156 | "diff" 1157 | ], 1158 | "time": "2017-05-22T07:24:03+00:00" 1159 | }, 1160 | { 1161 | "name": "sebastian/environment", 1162 | "version": "2.0.0", 1163 | "source": { 1164 | "type": "git", 1165 | "url": "https://github.com/sebastianbergmann/environment.git", 1166 | "reference": "5795ffe5dc5b02460c3e34222fee8cbe245d8fac" 1167 | }, 1168 | "dist": { 1169 | "type": "zip", 1170 | "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/5795ffe5dc5b02460c3e34222fee8cbe245d8fac", 1171 | "reference": "5795ffe5dc5b02460c3e34222fee8cbe245d8fac", 1172 | "shasum": "" 1173 | }, 1174 | "require": { 1175 | "php": "^5.6 || ^7.0" 1176 | }, 1177 | "require-dev": { 1178 | "phpunit/phpunit": "^5.0" 1179 | }, 1180 | "type": "library", 1181 | "extra": { 1182 | "branch-alias": { 1183 | "dev-master": "2.0.x-dev" 1184 | } 1185 | }, 1186 | "autoload": { 1187 | "classmap": [ 1188 | "src/" 1189 | ] 1190 | }, 1191 | "notification-url": "https://packagist.org/downloads/", 1192 | "license": [ 1193 | "BSD-3-Clause" 1194 | ], 1195 | "authors": [ 1196 | { 1197 | "name": "Sebastian Bergmann", 1198 | "email": "sebastian@phpunit.de" 1199 | } 1200 | ], 1201 | "description": "Provides functionality to handle HHVM/PHP environments", 1202 | "homepage": "http://www.github.com/sebastianbergmann/environment", 1203 | "keywords": [ 1204 | "Xdebug", 1205 | "environment", 1206 | "hhvm" 1207 | ], 1208 | "time": "2016-11-26T07:53:53+00:00" 1209 | }, 1210 | { 1211 | "name": "sebastian/exporter", 1212 | "version": "1.2.2", 1213 | "source": { 1214 | "type": "git", 1215 | "url": "https://github.com/sebastianbergmann/exporter.git", 1216 | "reference": "42c4c2eec485ee3e159ec9884f95b431287edde4" 1217 | }, 1218 | "dist": { 1219 | "type": "zip", 1220 | "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/42c4c2eec485ee3e159ec9884f95b431287edde4", 1221 | "reference": "42c4c2eec485ee3e159ec9884f95b431287edde4", 1222 | "shasum": "" 1223 | }, 1224 | "require": { 1225 | "php": ">=5.3.3", 1226 | "sebastian/recursion-context": "~1.0" 1227 | }, 1228 | "require-dev": { 1229 | "ext-mbstring": "*", 1230 | "phpunit/phpunit": "~4.4" 1231 | }, 1232 | "type": "library", 1233 | "extra": { 1234 | "branch-alias": { 1235 | "dev-master": "1.3.x-dev" 1236 | } 1237 | }, 1238 | "autoload": { 1239 | "classmap": [ 1240 | "src/" 1241 | ] 1242 | }, 1243 | "notification-url": "https://packagist.org/downloads/", 1244 | "license": [ 1245 | "BSD-3-Clause" 1246 | ], 1247 | "authors": [ 1248 | { 1249 | "name": "Jeff Welch", 1250 | "email": "whatthejeff@gmail.com" 1251 | }, 1252 | { 1253 | "name": "Volker Dusch", 1254 | "email": "github@wallbash.com" 1255 | }, 1256 | { 1257 | "name": "Bernhard Schussek", 1258 | "email": "bschussek@2bepublished.at" 1259 | }, 1260 | { 1261 | "name": "Sebastian Bergmann", 1262 | "email": "sebastian@phpunit.de" 1263 | }, 1264 | { 1265 | "name": "Adam Harvey", 1266 | "email": "aharvey@php.net" 1267 | } 1268 | ], 1269 | "description": "Provides the functionality to export PHP variables for visualization", 1270 | "homepage": "http://www.github.com/sebastianbergmann/exporter", 1271 | "keywords": [ 1272 | "export", 1273 | "exporter" 1274 | ], 1275 | "time": "2016-06-17T09:04:28+00:00" 1276 | }, 1277 | { 1278 | "name": "sebastian/global-state", 1279 | "version": "1.1.1", 1280 | "source": { 1281 | "type": "git", 1282 | "url": "https://github.com/sebastianbergmann/global-state.git", 1283 | "reference": "bc37d50fea7d017d3d340f230811c9f1d7280af4" 1284 | }, 1285 | "dist": { 1286 | "type": "zip", 1287 | "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/bc37d50fea7d017d3d340f230811c9f1d7280af4", 1288 | "reference": "bc37d50fea7d017d3d340f230811c9f1d7280af4", 1289 | "shasum": "" 1290 | }, 1291 | "require": { 1292 | "php": ">=5.3.3" 1293 | }, 1294 | "require-dev": { 1295 | "phpunit/phpunit": "~4.2" 1296 | }, 1297 | "suggest": { 1298 | "ext-uopz": "*" 1299 | }, 1300 | "type": "library", 1301 | "extra": { 1302 | "branch-alias": { 1303 | "dev-master": "1.0-dev" 1304 | } 1305 | }, 1306 | "autoload": { 1307 | "classmap": [ 1308 | "src/" 1309 | ] 1310 | }, 1311 | "notification-url": "https://packagist.org/downloads/", 1312 | "license": [ 1313 | "BSD-3-Clause" 1314 | ], 1315 | "authors": [ 1316 | { 1317 | "name": "Sebastian Bergmann", 1318 | "email": "sebastian@phpunit.de" 1319 | } 1320 | ], 1321 | "description": "Snapshotting of global state", 1322 | "homepage": "http://www.github.com/sebastianbergmann/global-state", 1323 | "keywords": [ 1324 | "global state" 1325 | ], 1326 | "time": "2015-10-12T03:26:01+00:00" 1327 | }, 1328 | { 1329 | "name": "sebastian/object-enumerator", 1330 | "version": "1.0.0", 1331 | "source": { 1332 | "type": "git", 1333 | "url": "https://github.com/sebastianbergmann/object-enumerator.git", 1334 | "reference": "d4ca2fb70344987502567bc50081c03e6192fb26" 1335 | }, 1336 | "dist": { 1337 | "type": "zip", 1338 | "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/d4ca2fb70344987502567bc50081c03e6192fb26", 1339 | "reference": "d4ca2fb70344987502567bc50081c03e6192fb26", 1340 | "shasum": "" 1341 | }, 1342 | "require": { 1343 | "php": ">=5.6", 1344 | "sebastian/recursion-context": "~1.0" 1345 | }, 1346 | "require-dev": { 1347 | "phpunit/phpunit": "~5" 1348 | }, 1349 | "type": "library", 1350 | "extra": { 1351 | "branch-alias": { 1352 | "dev-master": "1.0.x-dev" 1353 | } 1354 | }, 1355 | "autoload": { 1356 | "classmap": [ 1357 | "src/" 1358 | ] 1359 | }, 1360 | "notification-url": "https://packagist.org/downloads/", 1361 | "license": [ 1362 | "BSD-3-Clause" 1363 | ], 1364 | "authors": [ 1365 | { 1366 | "name": "Sebastian Bergmann", 1367 | "email": "sebastian@phpunit.de" 1368 | } 1369 | ], 1370 | "description": "Traverses array structures and object graphs to enumerate all referenced objects", 1371 | "homepage": "https://github.com/sebastianbergmann/object-enumerator/", 1372 | "time": "2016-01-28T13:25:10+00:00" 1373 | }, 1374 | { 1375 | "name": "sebastian/recursion-context", 1376 | "version": "1.0.5", 1377 | "source": { 1378 | "type": "git", 1379 | "url": "https://github.com/sebastianbergmann/recursion-context.git", 1380 | "reference": "b19cc3298482a335a95f3016d2f8a6950f0fbcd7" 1381 | }, 1382 | "dist": { 1383 | "type": "zip", 1384 | "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/b19cc3298482a335a95f3016d2f8a6950f0fbcd7", 1385 | "reference": "b19cc3298482a335a95f3016d2f8a6950f0fbcd7", 1386 | "shasum": "" 1387 | }, 1388 | "require": { 1389 | "php": ">=5.3.3" 1390 | }, 1391 | "require-dev": { 1392 | "phpunit/phpunit": "~4.4" 1393 | }, 1394 | "type": "library", 1395 | "extra": { 1396 | "branch-alias": { 1397 | "dev-master": "1.0.x-dev" 1398 | } 1399 | }, 1400 | "autoload": { 1401 | "classmap": [ 1402 | "src/" 1403 | ] 1404 | }, 1405 | "notification-url": "https://packagist.org/downloads/", 1406 | "license": [ 1407 | "BSD-3-Clause" 1408 | ], 1409 | "authors": [ 1410 | { 1411 | "name": "Jeff Welch", 1412 | "email": "whatthejeff@gmail.com" 1413 | }, 1414 | { 1415 | "name": "Sebastian Bergmann", 1416 | "email": "sebastian@phpunit.de" 1417 | }, 1418 | { 1419 | "name": "Adam Harvey", 1420 | "email": "aharvey@php.net" 1421 | } 1422 | ], 1423 | "description": "Provides functionality to recursively process PHP variables", 1424 | "homepage": "http://www.github.com/sebastianbergmann/recursion-context", 1425 | "time": "2016-10-03T07:41:43+00:00" 1426 | }, 1427 | { 1428 | "name": "sebastian/resource-operations", 1429 | "version": "1.0.0", 1430 | "source": { 1431 | "type": "git", 1432 | "url": "https://github.com/sebastianbergmann/resource-operations.git", 1433 | "reference": "ce990bb21759f94aeafd30209e8cfcdfa8bc3f52" 1434 | }, 1435 | "dist": { 1436 | "type": "zip", 1437 | "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/ce990bb21759f94aeafd30209e8cfcdfa8bc3f52", 1438 | "reference": "ce990bb21759f94aeafd30209e8cfcdfa8bc3f52", 1439 | "shasum": "" 1440 | }, 1441 | "require": { 1442 | "php": ">=5.6.0" 1443 | }, 1444 | "type": "library", 1445 | "extra": { 1446 | "branch-alias": { 1447 | "dev-master": "1.0.x-dev" 1448 | } 1449 | }, 1450 | "autoload": { 1451 | "classmap": [ 1452 | "src/" 1453 | ] 1454 | }, 1455 | "notification-url": "https://packagist.org/downloads/", 1456 | "license": [ 1457 | "BSD-3-Clause" 1458 | ], 1459 | "authors": [ 1460 | { 1461 | "name": "Sebastian Bergmann", 1462 | "email": "sebastian@phpunit.de" 1463 | } 1464 | ], 1465 | "description": "Provides a list of PHP built-in functions that operate on resources", 1466 | "homepage": "https://www.github.com/sebastianbergmann/resource-operations", 1467 | "time": "2015-07-28T20:34:47+00:00" 1468 | }, 1469 | { 1470 | "name": "sebastian/version", 1471 | "version": "2.0.1", 1472 | "source": { 1473 | "type": "git", 1474 | "url": "https://github.com/sebastianbergmann/version.git", 1475 | "reference": "99732be0ddb3361e16ad77b68ba41efc8e979019" 1476 | }, 1477 | "dist": { 1478 | "type": "zip", 1479 | "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/99732be0ddb3361e16ad77b68ba41efc8e979019", 1480 | "reference": "99732be0ddb3361e16ad77b68ba41efc8e979019", 1481 | "shasum": "" 1482 | }, 1483 | "require": { 1484 | "php": ">=5.6" 1485 | }, 1486 | "type": "library", 1487 | "extra": { 1488 | "branch-alias": { 1489 | "dev-master": "2.0.x-dev" 1490 | } 1491 | }, 1492 | "autoload": { 1493 | "classmap": [ 1494 | "src/" 1495 | ] 1496 | }, 1497 | "notification-url": "https://packagist.org/downloads/", 1498 | "license": [ 1499 | "BSD-3-Clause" 1500 | ], 1501 | "authors": [ 1502 | { 1503 | "name": "Sebastian Bergmann", 1504 | "email": "sebastian@phpunit.de", 1505 | "role": "lead" 1506 | } 1507 | ], 1508 | "description": "Library that helps with managing the version number of Git-hosted PHP projects", 1509 | "homepage": "https://github.com/sebastianbergmann/version", 1510 | "time": "2016-10-03T07:35:21+00:00" 1511 | }, 1512 | { 1513 | "name": "sunra/php-simple-html-dom-parser", 1514 | "version": "v1.5.2", 1515 | "source": { 1516 | "type": "git", 1517 | "url": "https://github.com/sunra/php-simple-html-dom-parser.git", 1518 | "reference": "75b9b1cb64502d8f8c04dc11b5906b969af247c6" 1519 | }, 1520 | "dist": { 1521 | "type": "zip", 1522 | "url": "https://api.github.com/repos/sunra/php-simple-html-dom-parser/zipball/75b9b1cb64502d8f8c04dc11b5906b969af247c6", 1523 | "reference": "75b9b1cb64502d8f8c04dc11b5906b969af247c6", 1524 | "shasum": "" 1525 | }, 1526 | "require": { 1527 | "ext-mbstring": "*", 1528 | "php": ">=5.3.2" 1529 | }, 1530 | "type": "library", 1531 | "autoload": { 1532 | "psr-0": { 1533 | "Sunra\\PhpSimple\\HtmlDomParser": "Src/" 1534 | } 1535 | }, 1536 | "notification-url": "https://packagist.org/downloads/", 1537 | "license": [ 1538 | "MIT" 1539 | ], 1540 | "authors": [ 1541 | { 1542 | "name": "Sunra", 1543 | "email": "sunra@yandex.ru", 1544 | "homepage": "https://github.com/sunra" 1545 | }, 1546 | { 1547 | "name": "S.C. Chen", 1548 | "homepage": "http://sourceforge.net/projects/simplehtmldom/" 1549 | } 1550 | ], 1551 | "description": "Composer adaptation of: A HTML DOM parser written in PHP5+ let you manipulate HTML in a very easy way! Require PHP 5+. Supports invalid HTML. Find tags on an HTML page with selectors just like jQuery. Extract contents from HTML in a single line.", 1552 | "homepage": "https://github.com/sunra/php-simple-html-dom-parser", 1553 | "keywords": [ 1554 | "dom", 1555 | "html", 1556 | "parser" 1557 | ], 1558 | "time": "2016-11-22T22:57:47+00:00" 1559 | }, 1560 | { 1561 | "name": "symfony/polyfill-ctype", 1562 | "version": "v1.9.0", 1563 | "source": { 1564 | "type": "git", 1565 | "url": "https://github.com/symfony/polyfill-ctype.git", 1566 | "reference": "e3d826245268269cd66f8326bd8bc066687b4a19" 1567 | }, 1568 | "dist": { 1569 | "type": "zip", 1570 | "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/e3d826245268269cd66f8326bd8bc066687b4a19", 1571 | "reference": "e3d826245268269cd66f8326bd8bc066687b4a19", 1572 | "shasum": "" 1573 | }, 1574 | "require": { 1575 | "php": ">=5.3.3" 1576 | }, 1577 | "suggest": { 1578 | "ext-ctype": "For best performance" 1579 | }, 1580 | "type": "library", 1581 | "extra": { 1582 | "branch-alias": { 1583 | "dev-master": "1.9-dev" 1584 | } 1585 | }, 1586 | "autoload": { 1587 | "psr-4": { 1588 | "Symfony\\Polyfill\\Ctype\\": "" 1589 | }, 1590 | "files": [ 1591 | "bootstrap.php" 1592 | ] 1593 | }, 1594 | "notification-url": "https://packagist.org/downloads/", 1595 | "license": [ 1596 | "MIT" 1597 | ], 1598 | "authors": [ 1599 | { 1600 | "name": "Symfony Community", 1601 | "homepage": "https://symfony.com/contributors" 1602 | }, 1603 | { 1604 | "name": "Gert de Pagter", 1605 | "email": "BackEndTea@gmail.com" 1606 | } 1607 | ], 1608 | "description": "Symfony polyfill for ctype functions", 1609 | "homepage": "https://symfony.com", 1610 | "keywords": [ 1611 | "compatibility", 1612 | "ctype", 1613 | "polyfill", 1614 | "portable" 1615 | ], 1616 | "time": "2018-08-06T14:22:27+00:00" 1617 | }, 1618 | { 1619 | "name": "symfony/yaml", 1620 | "version": "v3.4.14", 1621 | "source": { 1622 | "type": "git", 1623 | "url": "https://github.com/symfony/yaml.git", 1624 | "reference": "810af2d35fc72b6cf5c01116806d2b65ccaaf2e2" 1625 | }, 1626 | "dist": { 1627 | "type": "zip", 1628 | "url": "https://api.github.com/repos/symfony/yaml/zipball/810af2d35fc72b6cf5c01116806d2b65ccaaf2e2", 1629 | "reference": "810af2d35fc72b6cf5c01116806d2b65ccaaf2e2", 1630 | "shasum": "" 1631 | }, 1632 | "require": { 1633 | "php": "^5.5.9|>=7.0.8", 1634 | "symfony/polyfill-ctype": "~1.8" 1635 | }, 1636 | "conflict": { 1637 | "symfony/console": "<3.4" 1638 | }, 1639 | "require-dev": { 1640 | "symfony/console": "~3.4|~4.0" 1641 | }, 1642 | "suggest": { 1643 | "symfony/console": "For validating YAML files using the lint command" 1644 | }, 1645 | "type": "library", 1646 | "extra": { 1647 | "branch-alias": { 1648 | "dev-master": "3.4-dev" 1649 | } 1650 | }, 1651 | "autoload": { 1652 | "psr-4": { 1653 | "Symfony\\Component\\Yaml\\": "" 1654 | }, 1655 | "exclude-from-classmap": [ 1656 | "/Tests/" 1657 | ] 1658 | }, 1659 | "notification-url": "https://packagist.org/downloads/", 1660 | "license": [ 1661 | "MIT" 1662 | ], 1663 | "authors": [ 1664 | { 1665 | "name": "Fabien Potencier", 1666 | "email": "fabien@symfony.com" 1667 | }, 1668 | { 1669 | "name": "Symfony Community", 1670 | "homepage": "https://symfony.com/contributors" 1671 | } 1672 | ], 1673 | "description": "Symfony Yaml Component", 1674 | "homepage": "https://symfony.com", 1675 | "time": "2018-07-26T11:19:56+00:00" 1676 | }, 1677 | { 1678 | "name": "webmozart/assert", 1679 | "version": "1.3.0", 1680 | "source": { 1681 | "type": "git", 1682 | "url": "https://github.com/webmozart/assert.git", 1683 | "reference": "0df1908962e7a3071564e857d86874dad1ef204a" 1684 | }, 1685 | "dist": { 1686 | "type": "zip", 1687 | "url": "https://api.github.com/repos/webmozart/assert/zipball/0df1908962e7a3071564e857d86874dad1ef204a", 1688 | "reference": "0df1908962e7a3071564e857d86874dad1ef204a", 1689 | "shasum": "" 1690 | }, 1691 | "require": { 1692 | "php": "^5.3.3 || ^7.0" 1693 | }, 1694 | "require-dev": { 1695 | "phpunit/phpunit": "^4.6", 1696 | "sebastian/version": "^1.0.1" 1697 | }, 1698 | "type": "library", 1699 | "extra": { 1700 | "branch-alias": { 1701 | "dev-master": "1.3-dev" 1702 | } 1703 | }, 1704 | "autoload": { 1705 | "psr-4": { 1706 | "Webmozart\\Assert\\": "src/" 1707 | } 1708 | }, 1709 | "notification-url": "https://packagist.org/downloads/", 1710 | "license": [ 1711 | "MIT" 1712 | ], 1713 | "authors": [ 1714 | { 1715 | "name": "Bernhard Schussek", 1716 | "email": "bschussek@gmail.com" 1717 | } 1718 | ], 1719 | "description": "Assertions to validate method input/output with nice error messages.", 1720 | "keywords": [ 1721 | "assert", 1722 | "check", 1723 | "validate" 1724 | ], 1725 | "time": "2018-01-29T19:49:41+00:00" 1726 | } 1727 | ], 1728 | "aliases": [], 1729 | "minimum-stability": "stable", 1730 | "stability-flags": [], 1731 | "prefer-stable": false, 1732 | "prefer-lowest": false, 1733 | "platform": { 1734 | "php": ">=7.1.0" 1735 | }, 1736 | "platform-dev": [] 1737 | } 1738 | -------------------------------------------------------------------------------- /examples/getProfile.php: -------------------------------------------------------------------------------- 1 | "; 8 | var_export($account->getProfile()); 9 | echo ""; 10 | -------------------------------------------------------------------------------- /examples/getTweets.php: -------------------------------------------------------------------------------- 1 | loadTweets(); 8 | 9 | echo "
";
10 | var_export($account->getTweets());
11 | echo "
"; 12 | -------------------------------------------------------------------------------- /src/Models/Account.php: -------------------------------------------------------------------------------- 1 | name; 97 | } 98 | 99 | /** 100 | * @return string 101 | */ 102 | public function getAvatarUrl() 103 | { 104 | return $this->avatarUrl; 105 | } 106 | 107 | /** 108 | * @return string 109 | */ 110 | public function getCoverUrl() 111 | { 112 | return $this->coverUrl; 113 | } 114 | 115 | /** 116 | * @return string 117 | */ 118 | public function getWebsite() 119 | { 120 | return $this->website; 121 | } 122 | 123 | /** 124 | * @return string 125 | */ 126 | public function getLocale() 127 | { 128 | return $this->locale; 129 | } 130 | 131 | /** 132 | * @return string 133 | */ 134 | public function getBio() 135 | { 136 | return $this->bio; 137 | } 138 | 139 | /** 140 | * @return int 141 | */ 142 | public function getFollowingCount() 143 | { 144 | return $this->followingCount; 145 | } 146 | 147 | /** 148 | * @return int 149 | */ 150 | public function getFollowersCount() 151 | { 152 | return $this->followersCount; 153 | } 154 | 155 | /** 156 | * @return int 157 | */ 158 | public function getTweetsCount() 159 | { 160 | return $this->tweetsCount; 161 | } 162 | 163 | /** 164 | * @return int 165 | */ 166 | public function getListsCount() 167 | { 168 | return $this->listsCount; 169 | } 170 | 171 | /** 172 | * @return int 173 | */ 174 | public function getFavoritesCount() 175 | { 176 | return $this->favoritesCount; 177 | } 178 | 179 | /** 180 | * @return bool 181 | */ 182 | public function getIsVerified() 183 | { 184 | return $this->isVerified; 185 | } 186 | 187 | /** 188 | * @return int 189 | */ 190 | public function getDateOfBirth() 191 | { 192 | return $this->dateOfBirth; 193 | } 194 | 195 | /** 196 | * @return string 197 | */ 198 | public function getJoinedAt() 199 | { 200 | return $this->joinedAt; 201 | } 202 | 203 | /** 204 | * @param $value 205 | * @param $prop 206 | */ 207 | public function initProperties($value, $prop) 208 | { 209 | switch ($prop) { 210 | case 'name': 211 | $this->name = $value; 212 | break; 213 | case 'joined_at': 214 | $this->joinedAt = $value; 215 | break; 216 | case 'avatar_url': 217 | $this->avatarUrl = $value; 218 | break; 219 | case 'cover_url': 220 | $this->coverUrl = $value; 221 | break; 222 | case 'website': 223 | $this->website = $value; 224 | break; 225 | case 'locale': 226 | $this->locale = $value; 227 | break; 228 | case 'bio': 229 | $this->bio = $value; 230 | break; 231 | case 'following_count': 232 | $this->followingCount = $value; 233 | break; 234 | case 'followers_count': 235 | $this->followersCount = $value; 236 | break; 237 | case 'tweets_count': 238 | $this->tweetsCount = $value; 239 | break; 240 | case 'favorites_count': 241 | $this->favoritesCount = $value; 242 | break; 243 | case 'lists_count': 244 | $this->listsCount = $value; 245 | break; 246 | case 'date_of_birth': 247 | $this->dateOfBirth = $value; 248 | break; 249 | case 'is_verified': 250 | $this->isVerified = (bool) $value; 251 | break; 252 | } 253 | } 254 | 255 | /** 256 | * Implements JsonSerializable 257 | * 258 | * @return array|mixed 259 | */ 260 | public function jsonSerialize() 261 | { 262 | return 263 | [ 264 | 'name' => $this->getName(), 265 | 'joined_at' => $this->getJoinedAt(), 266 | 'avatar_url' => $this->getAvatarUrl(), 267 | 'cover_url' => $this->getCoverUrl(), 268 | 'website' => $this->getWebsite(), 269 | 'locale' => $this->getLocale(), 270 | 'bio' => $this->getBio(), 271 | 'following_count' => $this->getFollowingCount(), 272 | 'followers_count' => $this->getFollowersCount(), 273 | 'tweets_count' => $this->getTweetsCount(), 274 | 'favorites_count' => $this->getFavoritesCount(), 275 | 'lists_count' => $this->getListsCount(), 276 | 'date_of_birth' => $this->getDateOfBirth(), 277 | 'is_verified' => $this->getIsVerified(), 278 | ]; 279 | } 280 | } 281 | -------------------------------------------------------------------------------- /src/Models/ModelAbstract.php: -------------------------------------------------------------------------------- 1 | init($props); 18 | } 19 | 20 | /** 21 | * @param array $props 22 | * 23 | * @return $this 24 | */ 25 | final protected function init(array $props) 26 | { 27 | foreach ($props as $prop => $value) { 28 | $this->initProperties($value, $prop); 29 | } 30 | 31 | return $this; 32 | } 33 | 34 | /** 35 | * @var array 36 | */ 37 | protected static $initPropertiesMap = []; 38 | 39 | /** 40 | * @return array 41 | */ 42 | public static function getColumns() 43 | { 44 | return array_keys(static::$initPropertiesMap); 45 | } 46 | 47 | /** 48 | * @param array $params 49 | * 50 | * @return static 51 | */ 52 | public static function create(array $params = null) 53 | { 54 | return new static($params); 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /src/Models/ModelInterface.php: -------------------------------------------------------------------------------- 1 | id; 61 | } 62 | 63 | /** 64 | * @return string 65 | */ 66 | public function getUsername() 67 | { 68 | return $this->username; 69 | } 70 | 71 | /** 72 | * @return string 73 | */ 74 | public function getisRetweet() 75 | { 76 | return $this->isRetweet; 77 | } 78 | 79 | /** 80 | * @return string 81 | */ 82 | public function getContent() 83 | { 84 | return $this->content; 85 | } 86 | 87 | /** 88 | * @return string 89 | */ 90 | public function getCreatedAt() 91 | { 92 | return $this->createdAt; 93 | } 94 | 95 | /** 96 | * @return string 97 | */ 98 | public function getRepliesCount() 99 | { 100 | return $this->repliesCount; 101 | } 102 | 103 | /** 104 | * @return int 105 | */ 106 | public function getRetweetsCount() 107 | { 108 | return $this->retweetsCount; 109 | } 110 | 111 | /** 112 | * @return int 113 | */ 114 | public function getFavoritesCount() 115 | { 116 | return $this->favoritesCount; 117 | } 118 | 119 | /** 120 | * @param $value 121 | * @param $prop 122 | */ 123 | public function initProperties($value, $prop) 124 | { 125 | switch ($prop) { 126 | case 'id': 127 | $this->id = $value; 128 | break; 129 | case 'username': 130 | $this->username = $value; 131 | break; 132 | case 'is_retweet': 133 | $this->isRetweet = (bool) $value; 134 | break; 135 | case 'content': 136 | $this->content = $value; 137 | break; 138 | case 'created_at': 139 | $this->createdAt = $value; 140 | break; 141 | case 'replies_count': 142 | $this->repliesCount = $value; 143 | break; 144 | case 'retweets_count': 145 | $this->retweetsCount = $value; 146 | break; 147 | case 'favorites_count': 148 | $this->favoritesCount = $value; 149 | break; 150 | } 151 | } 152 | 153 | /** 154 | * Implements JsonSerializable 155 | * 156 | * @return array|mixed 157 | */ 158 | public function jsonSerialize() 159 | { 160 | return 161 | [ 162 | 'id' => $this->getId(), 163 | 'username' => $this->getUsername(), 164 | 'is_retweet' => $this->getisRetweet(), 165 | 'content' => $this->getContent(), 166 | 'created_at' => $this->getCreatedAt(), 167 | 'replies_count' => $this->getRepliesCount(), 168 | 'retweets_count' => $this->getRetweetsCount(), 169 | 'favorites_count' => $this->getFavoritesCount() 170 | ]; 171 | } 172 | } 173 | -------------------------------------------------------------------------------- /src/Traits/ArrayLikeTrait.php: -------------------------------------------------------------------------------- 1 | isMethod($offset, 'get') || \property_exists($this, $offset); 16 | } 17 | 18 | /** 19 | * @param mixed $offset 20 | * 21 | * @return mixed 22 | */ 23 | public function offsetGet($offset) 24 | { 25 | if ($run = $this->isMethod($offset, 'get')) { 26 | return $this->run($run); 27 | } elseif (\property_exists($this, $offset)) { 28 | if (isset($this->{$offset})) { 29 | return $this->{$offset}; 30 | } elseif (isset($this::$offset)) { 31 | return $this::$offset; 32 | } 33 | } 34 | 35 | return null; 36 | } 37 | 38 | /** 39 | * @param mixed $offset 40 | * @param mixed $value 41 | * 42 | * @return void 43 | */ 44 | public function offsetSet($offset, $value) 45 | { 46 | if ($run = $this->isMethod($offset, 'set')) { 47 | $this->run($run); 48 | } else { 49 | $this->{$offset} = $value; 50 | } 51 | } 52 | 53 | /** 54 | * @param mixed $offset 55 | * 56 | * @return void 57 | */ 58 | public function offsetUnset($offset) 59 | { 60 | if ($run = $this->isMethod($offset, 'unset')) { 61 | $this->run($run); 62 | } else { 63 | $this->{$offset} = null; 64 | } 65 | } 66 | 67 | /** 68 | * @param $method 69 | * @param $case 70 | * 71 | * @return bool|string 72 | */ 73 | protected function isMethod($method, $case) 74 | { 75 | $uMethod = $case . \ucfirst($method); 76 | if (\method_exists($this, $uMethod)) { 77 | return $uMethod; 78 | } 79 | if (\method_exists($this, $method)) { 80 | return $method; 81 | } 82 | return false; 83 | } 84 | 85 | /** 86 | * @param $method 87 | * 88 | * @return mixed 89 | */ 90 | protected function run($method) 91 | { 92 | if (\is_array($method)) { 93 | $params = $method; 94 | $method = \array_shift($params); 95 | if ($params) { 96 | return \call_user_func_array([$this, $method], $params); 97 | } 98 | } 99 | return \call_user_func([$this, $method]); 100 | } 101 | 102 | } 103 | -------------------------------------------------------------------------------- /src/Traits/HelpersTrait.php: -------------------------------------------------------------------------------- 1 | text); 13 | 14 | return (is_null($response) || empty($response)) ? $default : trim($response); 15 | } 16 | 17 | protected function sanitizeNodeAttr($node, $attr = 'title', $default = null) 18 | { 19 | $response = $default; 20 | 21 | if ($node) 22 | $response = trim($node->getAttribute($attr)); 23 | 24 | return (is_null($response) || empty($response)) ? $default : trim($response); 25 | } 26 | 27 | protected function countAttr($node, $attr = 'title', $default = 0) 28 | { 29 | if (!isset($node[0]->getAttributes()['data-tweet-stat-count'])) 30 | return $node->find('.ProfileTweet-actionCountForPresentation')->text; 31 | 32 | $count = $this->sanitizeNodeAttr($node[0], $attr, $default); 33 | 34 | return $count; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/Twitter.php: -------------------------------------------------------------------------------- 1 | setHandle($username); 23 | 24 | $dom = new Dom(); 25 | $dom->load('https://twitter.com/'.$username); 26 | 27 | $this->setDomHtml($dom); 28 | 29 | $this->extractProfileCard(); 30 | 31 | return $this; 32 | } 33 | 34 | /** 35 | * Extract basic data from user's account 36 | * 37 | * @return void 38 | */ 39 | protected function extractProfileCard() 40 | { 41 | $profileCard = $this->domHtml->find('div.ProfileHeaderCard'); 42 | $profileNav = $this->domHtml->find('div.ProfileNav'); 43 | 44 | $account = Account::create([ 45 | 'name' => $this->sanitizeNodeText($profileCard->find('.ProfileHeaderCard-nameLink')[0]), 46 | 'joined_at' => $profileCard->find('.ProfileHeaderCard-joinDateText')[0]->getAttribute('title'), 47 | 'locale' => $this->sanitizeNodeText($profileCard->find('.ProfileHeaderCard-locationText')[0]), 48 | 'website' => $this->sanitizeNodeAttr($profileCard->find('.ProfileHeaderCard-url a')[0]), 49 | 'date_of_birth' => $this->sanitizeNodeText($profileCard->find('.ProfileHeaderCard-birthdateText span')[0]), 50 | 'bio' => $this->sanitizeNodeText($profileCard->find('.ProfileHeaderCard-bio')[0]), 51 | 'avatar_url' => $this->sanitizeNodeAttr($this->domHtml->find('img.ProfileAvatar-image')[0], 'src'), 52 | 'cover_url' => $this->sanitizeNodeAttr($this->domHtml->find('div.ProfileCanopy-headerBg > img')[0], 'src'), 53 | 'tweets_count' => $this->sanitizeNodeAttr($profileNav->find('.ProfileNav-item--tweets .ProfileNav-value')[0], 'data-count'), 54 | 'following_count' => $this->sanitizeNodeAttr($profileNav->find('.ProfileNav-item--following .ProfileNav-value')[0], 'data-count'), 55 | 'followers_count' => $this->sanitizeNodeAttr($profileNav->find('.ProfileNav-item--followers .ProfileNav-value')[0], 'data-count'), 56 | 'favorites_count' => $this->sanitizeNodeAttr($profileNav->find('.ProfileNav-item--favorites .ProfileNav-value')[0], 'data-count'), 57 | 'lists_count' => $this->sanitizeNodeText($profileNav->find('.ProfileNav-item--lists .ProfileNav-value')[0], 0), 58 | 'is_verified' => count($this->domHtml->find('.ProfileHeaderCard-badges .Icon--verified')[0]) > 0, 59 | ]); 60 | 61 | $this->setProfile($account); 62 | } 63 | 64 | /** 65 | * Load last X reachable tweets from the user's account 66 | * 67 | * @return Twitter 68 | */ 69 | public function loadTweets() 70 | { 71 | $tweets = []; 72 | 73 | foreach($this->domHtml->find('li[data-item-type="tweet"] div.tweet') as $tweet) { 74 | array_push( 75 | $tweets, 76 | Tweet::create([ 77 | 'id' => $tweet->{'data-tweet-id'}, 78 | 'username' => $tweet->{'data-screen-name'}, 79 | 'is_retweet' => !is_null($tweet->find('.js-retweet-text')[0]), 80 | 'content' => $this->sanitizeNodeText($tweet->find('.tweet-text')[0]), 81 | 'created_at' => Carbon::createFromTimestampMs($this->sanitizeNodeAttr($tweet->find('.tweet-timestamp span')[0], 'data-time-ms')), 82 | 'replies_count' => $this->countAttr($tweet->find('.ProfileTweet-action--reply .ProfileTweet-actionCount'), 'data-tweet-stat-count'), 83 | 'retweets_count' => $this->countAttr($tweet->find('.ProfileTweet-action--retweet .ProfileTweet-actionCount'), 'data-tweet-stat-count'), 84 | 'favorites_count' => $this->countAttr($tweet->find('.ProfileTweet-action--favorite .ProfileTweet-actionCount'), 'data-tweet-stat-count'), 85 | ]) 86 | ); 87 | } 88 | 89 | $this->setTweets($tweets); 90 | 91 | return $this; 92 | } 93 | } 94 | -------------------------------------------------------------------------------- /src/TwitterAbstract.php: -------------------------------------------------------------------------------- 1 | profile; 43 | } 44 | 45 | /** 46 | * @return stdClass 47 | */ 48 | public function getTweets() 49 | { 50 | return $this->tweets; 51 | } 52 | 53 | /** 54 | * @param $handle 55 | */ 56 | protected function setHandle($handle) 57 | { 58 | $this->handle = $handle; 59 | } 60 | 61 | /** 62 | * @param $domHtml 63 | */ 64 | protected function setDomHtml($domHtml) 65 | { 66 | $this->domHtml = $domHtml; 67 | } 68 | 69 | /** 70 | * @param $profile 71 | */ 72 | protected function setProfile($profile) 73 | { 74 | $this->profile = $profile; 75 | } 76 | 77 | /** 78 | * @param $tweets 79 | */ 80 | protected function setTweets($tweets) 81 | { 82 | $this->tweets = $tweets; 83 | } 84 | 85 | /** 86 | * Load profile data from the Twitter account 87 | * 88 | * @return void 89 | */ 90 | abstract protected function extractProfileCard(); 91 | } 92 | --------------------------------------------------------------------------------