Skip to content

Commit

Permalink
Init
Browse files Browse the repository at this point in the history
  • Loading branch information
sheeep committed Feb 23, 2024
0 parents commit 0e414c3
Show file tree
Hide file tree
Showing 30 changed files with 4,950 additions and 0 deletions.
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# IDE
.idea

# Test
.phpunit.result.cache

# Dependencies
vendor
/tools/**/vendor
69 changes: 69 additions & 0 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
<?php

$finder = PhpCsFixer\Finder::create()
->exclude('Resources')
->exclude('Fixtures')
->in([__DIR__ . '/src', __DIR__ . '/tests'])
;

$config = new PhpCsFixer\Config();
return $config
->setRules([
'@Symfony' => true,
'@Symfony:risky' => true,
'@PHP71Migration' => true,
'@PHP71Migration:risky' => true,
'@PHP73Migration' => true,
'@PHP74Migration' => true,
'@PHP74Migration:risky' => true,
'@PHP80Migration' => true,
'@PHP80Migration:risky' => true,
'@PHP81Migration' => true,
'@PHP82Migration' => true,
'@PHPUnit60Migration:risky' => true,
'@PHPUnit75Migration:risky' => true,
'align_multiline_comment' => true,
'array_syntax' => ['syntax' => 'short'],
'concat_space' => [
'spacing' => 'one',
],
'combine_consecutive_issets' => false,
'combine_consecutive_unsets' => false,
'general_phpdoc_annotation_remove' => [
'annotations' => [
'author',
'expectedException',
'expectedExceptionMessage',
],
],
'heredoc_to_nowdoc' => true,
'linebreak_after_opening_tag' => true,
'list_syntax' => ['syntax' => 'short'],
'no_superfluous_elseif' => true,
'no_unreachable_default_argument_value' => true,
'no_useless_else' => true,
'no_useless_return' => true,
'ordered_class_elements' => true,
'ordered_imports' => true,
'ordered_traits' => false,
'php_unit_strict' => true,
'phpdoc_add_missing_param_annotation' => true,
'phpdoc_order' => true,
'phpdoc_types_order' => [
'null_adjustment' => 'always_last',
'sort_algorithm' => 'none',
],
'strict_comparison' => true,
'strict_param' => true,
'void_return' => true,
'phpdoc_separation' => [
'groups' => [
['ORM\\*'],
['Assert\\*']
]
],
])
->setFinder($finder)
->setRiskyAllowed(true)
->setUsingCache(false)
;
24 changes: 24 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# PHP Favicon Fetcher

```php
use Oneup\FaviconFetcher\FaviconFetcher;
use Oneup\FaviconFetcher\SizeParser;
use Oneup\FaviconFetcher\Strategy\RelIconStrategy;
use Oneup\FaviconFetcher\Strategy\AppleTouchIconStrategy;
use Oneup\FaviconFetcher\UrlNormalizer;

$httpClient = ...

$sizeParser = new SizeParser();
$urlNormalizer = new UrlNormalizer();

$faviconFetcher = new FaviconFetcher($httpClient, [
new RelIconStrategy($sizeParser, $urlNormalizer),
new AppleTouchIconStrategy($sizeParser, $urlNormalizer),
]);

$collection = $faviconFetcher->fetch('https://1up.io');
$favicon = $collection->findOneByMinimumSize(32, 32);

$contents = $faviconFetcher->download($favicon);
```
60 changes: 60 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
{
"require": {
"php": ">=8.2",
"ext-dom": "*",
"ext-libxml": "*",
"spatie/url": "^2.3",
"symfony/http-client": "^5.0|^6.0|^7.0"
},
"require-dev": {
"bamarni/composer-bin-plugin": "^1.8"
},
"autoload": {
"psr-4": {
"Oneup\\FaviconFetcher\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"Test\\Oneup\\FaviconFetcher\\": "tests/"
}
},
"config": {
"platform": {
"php": "8.2"
},
"preferred-install": {
"*": "dist"
},
"sort-packages": true,
"allow-plugins": {
"bamarni/composer-bin-plugin": true
}
},
"extra": {
"bamarni-bin": {
"bin-links": false,
"target-directory": "tools",
"forward-command": true
}
},
"scripts": {
"post-install-cmd": [
"@composer bin all install --ansi"
],
"post-update-cmd": [
"@composer bin all update --ansi"
],
"fix": [
"@php tools/php-cs-fixer/vendor/bin/php-cs-fixer fix -vvv --ansi"
],
"php-cs-fixer": [
"@php tools/php-cs-fixer/vendor/bin/php-cs-fixer fix --dry-run -vvv --ansi"
],
"phpunit": "@php tools/phpunit/vendor/bin/phpunit",
"pipeline": [
"@php-cs-fixer",
"@phpunit"
]
}
}
Loading

0 comments on commit 0e414c3

Please sign in to comment.