Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 02524fc

Browse files
committed
Merge pull request symfony#109 from thewilkybarkid/validate-composer-packages
Validate Composer packages
2 parents 68a86fe + 15252b2 commit 02524fc

2 files changed

Lines changed: 7 additions & 1 deletion

File tree

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ branches:
88
3.1.x:
99
time: 2015-03-19 16:54:00
1010
versions: [>=3.1.0,<3.1.11]
11-
reference: composer://framework/cms
11+
reference: composer://silverstripe/cms

validator.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,12 @@
7272
if (str_replace(DIRECTORY_SEPARATOR, '/', dirname($path)) !== $composerPackage) {
7373
$messages[$path][] = 'Reference composer package must match the folder name';
7474
}
75+
76+
$packagistUrl = sprintf('https://packagist.org/packages/%s.json', $composerPackage);
77+
78+
if(404 == explode(' ', get_headers($packagistUrl)[0], 3)[1]) {
79+
$messages[$path][] = sprintf('Invalid composer package');
80+
}
7581
}
7682
}
7783

0 commit comments

Comments
 (0)