├── .idea ├── DeadlinkChecker.iml ├── encodings.xml └── modules.xml ├── .phpunit.result.cache ├── LICENSE.txt ├── README.md ├── composer.json ├── composer.lock ├── phpunit.xml.dist.bak └── src └── CheckIfDead.php /.idea/DeadlinkChecker.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /.idea/encodings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /.phpunit.result.cache: -------------------------------------------------------------------------------- 1 | {"version":1,"defects":{"checkIfDeadTest::testIsLinkDead with data set #39":5,"checkIfDeadTest::testAreLinksDead":5},"times":{"checkIfDeadTest::testIsLinkDead with data set #0":2.801,"checkIfDeadTest::testIsLinkDead with data set #1":0.908,"checkIfDeadTest::testIsLinkDead with data set #2":2.821,"checkIfDeadTest::testIsLinkDead with data set #3":1.398,"checkIfDeadTest::testIsLinkDead with data set #4":1.527,"checkIfDeadTest::testIsLinkDead with data set #5":1.438,"checkIfDeadTest::testIsLinkDead with data set #6":4.896,"checkIfDeadTest::testIsLinkDead with data set #7":0.301,"checkIfDeadTest::testIsLinkDead with data set #8":0.167,"checkIfDeadTest::testIsLinkDead with data set #9":0.166,"checkIfDeadTest::testIsLinkDead with data set #10":3.663,"checkIfDeadTest::testIsLinkDead with data set #11":0.452,"checkIfDeadTest::testIsLinkDead with data set #12":1.276,"checkIfDeadTest::testIsLinkDead with data set #13":0.296,"checkIfDeadTest::testIsLinkDead with data set #14":1.836,"checkIfDeadTest::testIsLinkDead with data set #15":0.174,"checkIfDeadTest::testIsLinkDead with data set #16":0.567,"checkIfDeadTest::testIsLinkDead with data set #17":1.99,"checkIfDeadTest::testIsLinkDead with data set #18":0.593,"checkIfDeadTest::testIsLinkDead with data set #19":0.937,"checkIfDeadTest::testIsLinkDead with data set #20":2.389,"checkIfDeadTest::testIsLinkDead with data set #21":0.486,"checkIfDeadTest::testIsLinkDead with data set #22":0.283,"checkIfDeadTest::testIsLinkDead with data set #23":2.689,"checkIfDeadTest::testIsLinkDead with data set #24":0.368,"checkIfDeadTest::testIsLinkDead with data set #25":0.654,"checkIfDeadTest::testIsLinkDead with data set #26":0.349,"checkIfDeadTest::testIsLinkDead with data set #27":0.434,"checkIfDeadTest::testIsLinkDead with data set #28":1.021,"checkIfDeadTest::testIsLinkDead with data set #29":90.14,"checkIfDeadTest::testIsLinkDead with data set #30":2.945,"checkIfDeadTest::testIsLinkDead with data set #31":30.696,"checkIfDeadTest::testIsLinkDead with data set #32":0.14,"checkIfDeadTest::testIsLinkDead with data set #33":0.333,"checkIfDeadTest::testIsLinkDead with data set #34":0.353,"checkIfDeadTest::testIsLinkDead with data set #35":7.122,"checkIfDeadTest::testIsLinkDead with data set #36":31.27,"checkIfDeadTest::testIsLinkDead with data set #37":90.164,"checkIfDeadTest::testIsLinkDead with data set #38":0,"checkIfDeadTest::testIsLinkDead with data set #39":0,"checkIfDeadTest::testIsLinkDead with data set #40":1.345,"checkIfDeadTest::testAreLinksDead":2.795,"checkIfDeadTest::testCleanURL with data set #0":0,"checkIfDeadTest::testCleanURL with data set #1":0,"checkIfDeadTest::testCleanURL with data set #2":0,"checkIfDeadTest::testCleanURL with data set #3":0,"checkIfDeadTest::testCleanURL with data set #4":0,"checkIfDeadTest::testSanitizeURL with data set #0":0,"checkIfDeadTest::testSanitizeURL with data set #1":0,"checkIfDeadTest::testSanitizeURL with data set #2":0,"checkIfDeadTest::testSanitizeURL with data set #3":0,"checkIfDeadTest::testSanitizeURL with data set #4":0,"checkIfDeadTest::testSanitizeURL with data set #5":0,"checkIfDeadTest::testSanitizeURL with data set #6":0,"checkIfDeadTest::testSanitizeURL with data set #7":0,"checkIfDeadTest::testSanitizeURL with data set #8":0,"checkIfDeadTest::testSanitizeURL with data set #9":0,"checkIfDeadTest::testSanitizeURL with data set #10":0,"checkIfDeadTest::testSanitizeURL with data set #11":0,"checkIfDeadTest::testSanitizeURL with data set #12":0,"checkIfDeadTest::testSanitizeURL with data set #13":0,"checkIfDeadTest::testSanitizeURL with data set #14":0,"checkIfDeadTest::testSanitizeURL with data set #15":0,"checkIfDeadTest::testSanitizeURL with data set #16":0,"checkIfDeadTest::testSanitizeURL with data set #17":0,"checkIfDeadTest::testParseURL with data set #0":0,"checkIfDeadTest::testParseURL with data set #1":0}} -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | 635 | Copyright (C) 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | Copyright (C) 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # DeadlinkChecker 2 | 3 | Maintainer: [Cyberpower678](https://github.com/Cyberpower678) 4 | 5 | REQUIRES: PHP 7.3 or higher 6 | 7 | This is a PHP library for detecting whether URLs on the internet are alive or dead via cURL. It includes the following features: 8 | 9 | * Supports HTTP, HTTPS, FTP, MMS, and RTSP URLs 10 | * Supports TOR 11 | * Supports [internationalized domain names](https://en.wikipedia.org/wiki/Internationalized_domain_name) 12 | * Basic detection for [soft 404s](https://en.wikipedia.org/wiki/HTTP_404#Soft_404_errors) 13 | * For optimized performance, it initially performs a header-only page request (CURLOPT_NOBODY). If that request fails, it then tries to do a normal full body page request. 14 | * Concurrently checks batch of URLs for efficiency 15 | 16 | 17 | 18 | ### Overview 19 | 20 | The checkIfDead library is a PHP library designed for assessing the status of URLs on the web and dark web. It operates by taking one or more URLs as inputs and concurrently checks them, to enhance response times. 21 | 22 | It can handle both properly and improperly formatted URLs and performs basic sanity checking and error correction on malformed inputs. All inputs are normalized through the sanitizer to ensure the curl library communicates properly with the target. 23 | 24 | When left at defaults, the library will emulate a web browser request and follow redirects to its destination. 25 | 26 | ### Installation 27 | 28 | Using composer: 29 | Add the following to the composer.json file for your project: 30 | 31 | ``` 32 | { 33 | "require": { 34 | "wikimedia/deadlinkchecker": "dev-master" 35 | } 36 | } 37 | ``` 38 | 39 | And then run 'composer update'. 40 | 41 | Or using git: 42 | 43 | ``` 44 | $ git clone https://github.com/wikimedia/DeadlinkChecker.git 45 | ``` 46 | 47 | ### Basic Usage 48 | 49 | ##### For checking a single link: 50 | 51 | ``` 52 | $deadLinkChecker = new checkIfDead(); 53 | $url = 'https://en.wikipedia.org'; 54 | $exec = $deadLinkChecker->isLinkDead( $url ); 55 | echo var_export( $exec ); 56 | ``` 57 | 58 | Prints: 59 | 60 | ``` 61 | false 62 | ``` 63 | 64 | ##### For checking an array of links: 65 | 66 | ``` 67 | $deadLinkChecker = new checkIfDead(); 68 | $urls = [ 'https://en.wikipedia.org/nothing', 'https://en.wikipedia.org' ]; 69 | $exec = $deadLinkChecker->areLinksDead( $urls ); 70 | echo var_export( $exec ); 71 | ``` 72 | 73 | Prints: 74 | 75 | ``` 76 | array ( 77 | 'https://en.wikipedia.org/nothing' => true, 78 | 'https://en.wikipedia.org' => false, 79 | ) 80 | ``` 81 | 82 | Note that these functions will return `null` if they are unable to determine whether a link is alive or dead. 83 | 84 | ### Advanced Usage 85 | 86 | You can control how long it takes before page requests timeout by passing parameters to the constructor. To set the header-only page requests to a 10 second timeout and the full page requests to a 20 second timeout, you would use the following: 87 | 88 | ``` 89 | $deadLinkChecker = new checkIfDead( 10, 20 ); 90 | ``` 91 | 92 | In addition to controlling query timeouts, a custom user agent can be passed to the library as well like so: 93 | 94 | ```angular2html 95 | $deadLinkChecker = new checkIfDead( 10, 20, "Custom Agent" ); 96 | ``` 97 | 98 | By default, multiple URLs of the same domain are queued sequentially to be respectul to the hosts. However, this can be disabled so all URLs are queried concurrently as follows: 99 | 100 | ```angular2html 101 | $deadLinkChecker = new checkIfDead( 10, 20, "Custom Agent", false ); 102 | ``` 103 | 104 | You can increase the verbosity of the output to follow what the library is doing as it's doing it. 105 | 106 | ```angular2html 107 | $deadLinkChecker = new checkIfDead( 10, 20, "Custom Agent", true, true ); 108 | ``` 109 | 110 | Finally, because the library supports TOR requests, the environment will need a working SOCKS5 proxy to make the requests. The library looks for the SOCKS5 proxy using system defaults, but the proxy can be specified manually. 111 | 112 | ```angular2html 113 | $deadLinkChecker = new checkIfDead( 10, 20, "Custom Agent", true, false, "proxy.host", proxy_port ); 114 | ``` 115 | 116 | ### Getting details about the last batch of URLs checked 117 | 118 | After a batch of URLs have been checked, you can use `$deadLinkChecker->getErrors()` to get the curl errors encountered during the process, and `$deadLinkChecker->getRequestDetails()` to get the curl request details of all URLs checked in the last batch. 119 | 120 | ### Other functions 121 | 122 | To clean up dirty URLs and allow them to be normalized to correctly line with varying HTTP clients: 123 | 124 | ```angular2html 125 | $deadLinkChecker->sanitizeURL( "https://example.com/", $stripFragment ); 126 | ``` 127 | 128 | By default, $stripFragment is false. When set to true, URL fragments are dropped. 129 | 130 | Because PHP has a tendency to fail parsing URLs containing UTF-8 characters, you can use the library's parseURL method. 131 | 132 | ```angular2html 133 | $deadLinkChecker->parseURL( $url ); 134 | ``` 135 | 136 | ### License 137 | 138 | This code is distributed under [GNU GPLv3+](https://www.gnu.org/copyleft/gpl.html) -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "wikimedia/deadlinkchecker", 3 | "replace": { 4 | "niharika29/deadlinkchecker": "*" 5 | }, 6 | "type": "library", 7 | "description": "Library for checking if a given link is dead or alive", 8 | "keywords": [ 9 | "deadlink", 10 | "link" 11 | ], 12 | "homepage": "https://www.mediawiki.org/wiki/DeadlinkChecker", 13 | "license": "GPL-3.0-or-later", 14 | "authors": [ 15 | { 16 | "name": "Niharika Kohli", 17 | "email": "niharikakohli29@gmail.com", 18 | "role": "Developer" 19 | }, 20 | { 21 | "name": "Maximilian Doerr", 22 | "email": "maximilian.doerr@gmail.com", 23 | "role": "Developer" 24 | } 25 | ], 26 | "autoload": { 27 | "psr-4": { 28 | "Wikimedia\\DeadlinkChecker\\": "src/" 29 | } 30 | }, 31 | "require": { 32 | "ext-curl": "*", 33 | "ext-intl": "*", 34 | "lib-curl": ">=7.43.0", 35 | "php": ">=7.3.0" 36 | }, 37 | "require-dev": { 38 | "jakub-onderka/php-parallel-lint": "v1.0.0", 39 | "mediawiki/mediawiki-codesniffer": "v39.0.0", 40 | "phpunit/phpunit": "^9.6" 41 | }, 42 | "scripts": { 43 | "fix": "phpcbf", 44 | "test": [ 45 | "composer validate --no-interaction", 46 | "parallel-lint . --exclude vendor", 47 | "phpunit", 48 | "phpcs -p" 49 | ] 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /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": "72761c83d8556bd0dd4123b058972098", 8 | "packages": [], 9 | "packages-dev": [ 10 | { 11 | "name": "composer/semver", 12 | "version": "3.3.2", 13 | "source": { 14 | "type": "git", 15 | "url": "https://github.com/composer/semver.git", 16 | "reference": "3953f23262f2bff1919fc82183ad9acb13ff62c9" 17 | }, 18 | "dist": { 19 | "type": "zip", 20 | "url": "https://api.github.com/repos/composer/semver/zipball/3953f23262f2bff1919fc82183ad9acb13ff62c9", 21 | "reference": "3953f23262f2bff1919fc82183ad9acb13ff62c9", 22 | "shasum": "" 23 | }, 24 | "require": { 25 | "php": "^5.3.2 || ^7.0 || ^8.0" 26 | }, 27 | "require-dev": { 28 | "phpstan/phpstan": "^1.4", 29 | "symfony/phpunit-bridge": "^4.2 || ^5" 30 | }, 31 | "type": "library", 32 | "extra": { 33 | "branch-alias": { 34 | "dev-main": "3.x-dev" 35 | } 36 | }, 37 | "autoload": { 38 | "psr-4": { 39 | "Composer\\Semver\\": "src" 40 | } 41 | }, 42 | "notification-url": "https://packagist.org/downloads/", 43 | "license": [ 44 | "MIT" 45 | ], 46 | "authors": [ 47 | { 48 | "name": "Nils Adermann", 49 | "email": "naderman@naderman.de", 50 | "homepage": "http://www.naderman.de" 51 | }, 52 | { 53 | "name": "Jordi Boggiano", 54 | "email": "j.boggiano@seld.be", 55 | "homepage": "http://seld.be" 56 | }, 57 | { 58 | "name": "Rob Bast", 59 | "email": "rob.bast@gmail.com", 60 | "homepage": "http://robbast.nl" 61 | } 62 | ], 63 | "description": "Semver library that offers utilities, version constraint parsing and validation.", 64 | "keywords": [ 65 | "semantic", 66 | "semver", 67 | "validation", 68 | "versioning" 69 | ], 70 | "support": { 71 | "irc": "irc://irc.freenode.org/composer", 72 | "issues": "https://github.com/composer/semver/issues", 73 | "source": "https://github.com/composer/semver/tree/3.3.2" 74 | }, 75 | "funding": [ 76 | { 77 | "url": "https://packagist.com", 78 | "type": "custom" 79 | }, 80 | { 81 | "url": "https://github.com/composer", 82 | "type": "github" 83 | }, 84 | { 85 | "url": "https://tidelift.com/funding/github/packagist/composer/composer", 86 | "type": "tidelift" 87 | } 88 | ], 89 | "time": "2022-04-01T19:23:25+00:00" 90 | }, 91 | { 92 | "name": "composer/spdx-licenses", 93 | "version": "1.5.7", 94 | "source": { 95 | "type": "git", 96 | "url": "https://github.com/composer/spdx-licenses.git", 97 | "reference": "c848241796da2abf65837d51dce1fae55a960149" 98 | }, 99 | "dist": { 100 | "type": "zip", 101 | "url": "https://api.github.com/repos/composer/spdx-licenses/zipball/c848241796da2abf65837d51dce1fae55a960149", 102 | "reference": "c848241796da2abf65837d51dce1fae55a960149", 103 | "shasum": "" 104 | }, 105 | "require": { 106 | "php": "^5.3.2 || ^7.0 || ^8.0" 107 | }, 108 | "require-dev": { 109 | "phpstan/phpstan": "^0.12.55", 110 | "symfony/phpunit-bridge": "^4.2 || ^5" 111 | }, 112 | "type": "library", 113 | "extra": { 114 | "branch-alias": { 115 | "dev-main": "1.x-dev" 116 | } 117 | }, 118 | "autoload": { 119 | "psr-4": { 120 | "Composer\\Spdx\\": "src" 121 | } 122 | }, 123 | "notification-url": "https://packagist.org/downloads/", 124 | "license": [ 125 | "MIT" 126 | ], 127 | "authors": [ 128 | { 129 | "name": "Nils Adermann", 130 | "email": "naderman@naderman.de", 131 | "homepage": "http://www.naderman.de" 132 | }, 133 | { 134 | "name": "Jordi Boggiano", 135 | "email": "j.boggiano@seld.be", 136 | "homepage": "http://seld.be" 137 | }, 138 | { 139 | "name": "Rob Bast", 140 | "email": "rob.bast@gmail.com", 141 | "homepage": "http://robbast.nl" 142 | } 143 | ], 144 | "description": "SPDX licenses list and validation library.", 145 | "keywords": [ 146 | "license", 147 | "spdx", 148 | "validator" 149 | ], 150 | "support": { 151 | "irc": "irc://irc.freenode.org/composer", 152 | "issues": "https://github.com/composer/spdx-licenses/issues", 153 | "source": "https://github.com/composer/spdx-licenses/tree/1.5.7" 154 | }, 155 | "funding": [ 156 | { 157 | "url": "https://packagist.com", 158 | "type": "custom" 159 | }, 160 | { 161 | "url": "https://github.com/composer", 162 | "type": "github" 163 | }, 164 | { 165 | "url": "https://tidelift.com/funding/github/packagist/composer/composer", 166 | "type": "tidelift" 167 | } 168 | ], 169 | "time": "2022-05-23T07:37:50+00:00" 170 | }, 171 | { 172 | "name": "doctrine/instantiator", 173 | "version": "2.0.0", 174 | "source": { 175 | "type": "git", 176 | "url": "https://github.com/doctrine/instantiator.git", 177 | "reference": "c6222283fa3f4ac679f8b9ced9a4e23f163e80d0" 178 | }, 179 | "dist": { 180 | "type": "zip", 181 | "url": "https://api.github.com/repos/doctrine/instantiator/zipball/c6222283fa3f4ac679f8b9ced9a4e23f163e80d0", 182 | "reference": "c6222283fa3f4ac679f8b9ced9a4e23f163e80d0", 183 | "shasum": "" 184 | }, 185 | "require": { 186 | "php": "^8.1" 187 | }, 188 | "require-dev": { 189 | "doctrine/coding-standard": "^11", 190 | "ext-pdo": "*", 191 | "ext-phar": "*", 192 | "phpbench/phpbench": "^1.2", 193 | "phpstan/phpstan": "^1.9.4", 194 | "phpstan/phpstan-phpunit": "^1.3", 195 | "phpunit/phpunit": "^9.5.27", 196 | "vimeo/psalm": "^5.4" 197 | }, 198 | "type": "library", 199 | "autoload": { 200 | "psr-4": { 201 | "Doctrine\\Instantiator\\": "src/Doctrine/Instantiator/" 202 | } 203 | }, 204 | "notification-url": "https://packagist.org/downloads/", 205 | "license": [ 206 | "MIT" 207 | ], 208 | "authors": [ 209 | { 210 | "name": "Marco Pivetta", 211 | "email": "ocramius@gmail.com", 212 | "homepage": "https://ocramius.github.io/" 213 | } 214 | ], 215 | "description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors", 216 | "homepage": "https://www.doctrine-project.org/projects/instantiator.html", 217 | "keywords": [ 218 | "constructor", 219 | "instantiate" 220 | ], 221 | "support": { 222 | "issues": "https://github.com/doctrine/instantiator/issues", 223 | "source": "https://github.com/doctrine/instantiator/tree/2.0.0" 224 | }, 225 | "funding": [ 226 | { 227 | "url": "https://www.doctrine-project.org/sponsorship.html", 228 | "type": "custom" 229 | }, 230 | { 231 | "url": "https://www.patreon.com/phpdoctrine", 232 | "type": "patreon" 233 | }, 234 | { 235 | "url": "https://tidelift.com/funding/github/packagist/doctrine%2Finstantiator", 236 | "type": "tidelift" 237 | } 238 | ], 239 | "time": "2022-12-30T00:23:10+00:00" 240 | }, 241 | { 242 | "name": "jakub-onderka/php-parallel-lint", 243 | "version": "v1.0.0", 244 | "source": { 245 | "type": "git", 246 | "url": "https://github.com/JakubOnderka/PHP-Parallel-Lint.git", 247 | "reference": "04fbd3f5fb1c83f08724aa58a23db90bd9086ee8" 248 | }, 249 | "dist": { 250 | "type": "zip", 251 | "url": "https://api.github.com/repos/JakubOnderka/PHP-Parallel-Lint/zipball/04fbd3f5fb1c83f08724aa58a23db90bd9086ee8", 252 | "reference": "04fbd3f5fb1c83f08724aa58a23db90bd9086ee8", 253 | "shasum": "" 254 | }, 255 | "require": { 256 | "php": ">=5.3.3" 257 | }, 258 | "require-dev": { 259 | "jakub-onderka/php-console-highlighter": "~0.3", 260 | "nette/tester": "~1.3", 261 | "squizlabs/php_codesniffer": "~2.7" 262 | }, 263 | "suggest": { 264 | "jakub-onderka/php-console-highlighter": "Highlight syntax in code snippet" 265 | }, 266 | "bin": [ 267 | "parallel-lint" 268 | ], 269 | "type": "library", 270 | "autoload": { 271 | "classmap": [ 272 | "./" 273 | ] 274 | }, 275 | "notification-url": "https://packagist.org/downloads/", 276 | "license": [ 277 | "BSD-2-Clause" 278 | ], 279 | "authors": [ 280 | { 281 | "name": "Jakub Onderka", 282 | "email": "ahoj@jakubonderka.cz" 283 | } 284 | ], 285 | "description": "This tool check syntax of PHP files about 20x faster than serial check.", 286 | "homepage": "https://github.com/JakubOnderka/PHP-Parallel-Lint", 287 | "support": { 288 | "issues": "https://github.com/JakubOnderka/PHP-Parallel-Lint/issues", 289 | "source": "https://github.com/JakubOnderka/PHP-Parallel-Lint/tree/master" 290 | }, 291 | "abandoned": "php-parallel-lint/php-parallel-lint", 292 | "time": "2018-02-24T15:31:20+00:00" 293 | }, 294 | { 295 | "name": "mediawiki/mediawiki-codesniffer", 296 | "version": "v39.0.0", 297 | "source": { 298 | "type": "git", 299 | "url": "https://github.com/wikimedia/mediawiki-tools-codesniffer.git", 300 | "reference": "9d6d7ea4314f928e8967bb386bb54c17bb96fb77" 301 | }, 302 | "dist": { 303 | "type": "zip", 304 | "url": "https://api.github.com/repos/wikimedia/mediawiki-tools-codesniffer/zipball/9d6d7ea4314f928e8967bb386bb54c17bb96fb77", 305 | "reference": "9d6d7ea4314f928e8967bb386bb54c17bb96fb77", 306 | "shasum": "" 307 | }, 308 | "require": { 309 | "composer/semver": "3.3.2", 310 | "composer/spdx-licenses": "~1.5.2", 311 | "ext-json": "*", 312 | "ext-mbstring": "*", 313 | "php": ">=7.2.0", 314 | "squizlabs/php_codesniffer": "3.6.2" 315 | }, 316 | "require-dev": { 317 | "mediawiki/mediawiki-phan-config": "0.11.1", 318 | "mediawiki/minus-x": "1.1.1", 319 | "php-parallel-lint/php-console-highlighter": "1.0.0", 320 | "php-parallel-lint/php-parallel-lint": "1.3.2", 321 | "phpunit/phpunit": "^8.5" 322 | }, 323 | "type": "phpcodesniffer-standard", 324 | "autoload": { 325 | "psr-4": { 326 | "MediaWiki\\Sniffs\\": "MediaWiki/Sniffs/", 327 | "MediaWiki\\Sniffs\\Tests\\": "MediaWiki/Tests/" 328 | } 329 | }, 330 | "notification-url": "https://packagist.org/downloads/", 331 | "license": [ 332 | "GPL-2.0-or-later" 333 | ], 334 | "description": "MediaWiki CodeSniffer Standards", 335 | "homepage": "https://www.mediawiki.org/wiki/Manual:Coding_conventions/PHP", 336 | "keywords": [ 337 | "codesniffer", 338 | "mediawiki" 339 | ], 340 | "support": { 341 | "source": "https://github.com/wikimedia/mediawiki-tools-codesniffer/tree/v39.0.0" 342 | }, 343 | "time": "2022-05-04T16:19:01+00:00" 344 | }, 345 | { 346 | "name": "myclabs/deep-copy", 347 | "version": "1.11.1", 348 | "source": { 349 | "type": "git", 350 | "url": "https://github.com/myclabs/DeepCopy.git", 351 | "reference": "7284c22080590fb39f2ffa3e9057f10a4ddd0e0c" 352 | }, 353 | "dist": { 354 | "type": "zip", 355 | "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/7284c22080590fb39f2ffa3e9057f10a4ddd0e0c", 356 | "reference": "7284c22080590fb39f2ffa3e9057f10a4ddd0e0c", 357 | "shasum": "" 358 | }, 359 | "require": { 360 | "php": "^7.1 || ^8.0" 361 | }, 362 | "conflict": { 363 | "doctrine/collections": "<1.6.8", 364 | "doctrine/common": "<2.13.3 || >=3,<3.2.2" 365 | }, 366 | "require-dev": { 367 | "doctrine/collections": "^1.6.8", 368 | "doctrine/common": "^2.13.3 || ^3.2.2", 369 | "phpunit/phpunit": "^7.5.20 || ^8.5.23 || ^9.5.13" 370 | }, 371 | "type": "library", 372 | "autoload": { 373 | "files": [ 374 | "src/DeepCopy/deep_copy.php" 375 | ], 376 | "psr-4": { 377 | "DeepCopy\\": "src/DeepCopy/" 378 | } 379 | }, 380 | "notification-url": "https://packagist.org/downloads/", 381 | "license": [ 382 | "MIT" 383 | ], 384 | "description": "Create deep copies (clones) of your objects", 385 | "keywords": [ 386 | "clone", 387 | "copy", 388 | "duplicate", 389 | "object", 390 | "object graph" 391 | ], 392 | "support": { 393 | "issues": "https://github.com/myclabs/DeepCopy/issues", 394 | "source": "https://github.com/myclabs/DeepCopy/tree/1.11.1" 395 | }, 396 | "funding": [ 397 | { 398 | "url": "https://tidelift.com/funding/github/packagist/myclabs/deep-copy", 399 | "type": "tidelift" 400 | } 401 | ], 402 | "time": "2023-03-08T13:26:56+00:00" 403 | }, 404 | { 405 | "name": "nikic/php-parser", 406 | "version": "v4.17.1", 407 | "source": { 408 | "type": "git", 409 | "url": "https://github.com/nikic/PHP-Parser.git", 410 | "reference": "a6303e50c90c355c7eeee2c4a8b27fe8dc8fef1d" 411 | }, 412 | "dist": { 413 | "type": "zip", 414 | "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/a6303e50c90c355c7eeee2c4a8b27fe8dc8fef1d", 415 | "reference": "a6303e50c90c355c7eeee2c4a8b27fe8dc8fef1d", 416 | "shasum": "" 417 | }, 418 | "require": { 419 | "ext-tokenizer": "*", 420 | "php": ">=7.0" 421 | }, 422 | "require-dev": { 423 | "ircmaxell/php-yacc": "^0.0.7", 424 | "phpunit/phpunit": "^6.5 || ^7.0 || ^8.0 || ^9.0" 425 | }, 426 | "bin": [ 427 | "bin/php-parse" 428 | ], 429 | "type": "library", 430 | "extra": { 431 | "branch-alias": { 432 | "dev-master": "4.9-dev" 433 | } 434 | }, 435 | "autoload": { 436 | "psr-4": { 437 | "PhpParser\\": "lib/PhpParser" 438 | } 439 | }, 440 | "notification-url": "https://packagist.org/downloads/", 441 | "license": [ 442 | "BSD-3-Clause" 443 | ], 444 | "authors": [ 445 | { 446 | "name": "Nikita Popov" 447 | } 448 | ], 449 | "description": "A PHP parser written in PHP", 450 | "keywords": [ 451 | "parser", 452 | "php" 453 | ], 454 | "support": { 455 | "issues": "https://github.com/nikic/PHP-Parser/issues", 456 | "source": "https://github.com/nikic/PHP-Parser/tree/v4.17.1" 457 | }, 458 | "time": "2023-08-13T19:53:39+00:00" 459 | }, 460 | { 461 | "name": "phar-io/manifest", 462 | "version": "2.0.3", 463 | "source": { 464 | "type": "git", 465 | "url": "https://github.com/phar-io/manifest.git", 466 | "reference": "97803eca37d319dfa7826cc2437fc020857acb53" 467 | }, 468 | "dist": { 469 | "type": "zip", 470 | "url": "https://api.github.com/repos/phar-io/manifest/zipball/97803eca37d319dfa7826cc2437fc020857acb53", 471 | "reference": "97803eca37d319dfa7826cc2437fc020857acb53", 472 | "shasum": "" 473 | }, 474 | "require": { 475 | "ext-dom": "*", 476 | "ext-phar": "*", 477 | "ext-xmlwriter": "*", 478 | "phar-io/version": "^3.0.1", 479 | "php": "^7.2 || ^8.0" 480 | }, 481 | "type": "library", 482 | "extra": { 483 | "branch-alias": { 484 | "dev-master": "2.0.x-dev" 485 | } 486 | }, 487 | "autoload": { 488 | "classmap": [ 489 | "src/" 490 | ] 491 | }, 492 | "notification-url": "https://packagist.org/downloads/", 493 | "license": [ 494 | "BSD-3-Clause" 495 | ], 496 | "authors": [ 497 | { 498 | "name": "Arne Blankerts", 499 | "email": "arne@blankerts.de", 500 | "role": "Developer" 501 | }, 502 | { 503 | "name": "Sebastian Heuer", 504 | "email": "sebastian@phpeople.de", 505 | "role": "Developer" 506 | }, 507 | { 508 | "name": "Sebastian Bergmann", 509 | "email": "sebastian@phpunit.de", 510 | "role": "Developer" 511 | } 512 | ], 513 | "description": "Component for reading phar.io manifest information from a PHP Archive (PHAR)", 514 | "support": { 515 | "issues": "https://github.com/phar-io/manifest/issues", 516 | "source": "https://github.com/phar-io/manifest/tree/2.0.3" 517 | }, 518 | "time": "2021-07-20T11:28:43+00:00" 519 | }, 520 | { 521 | "name": "phar-io/version", 522 | "version": "3.2.1", 523 | "source": { 524 | "type": "git", 525 | "url": "https://github.com/phar-io/version.git", 526 | "reference": "4f7fd7836c6f332bb2933569e566a0d6c4cbed74" 527 | }, 528 | "dist": { 529 | "type": "zip", 530 | "url": "https://api.github.com/repos/phar-io/version/zipball/4f7fd7836c6f332bb2933569e566a0d6c4cbed74", 531 | "reference": "4f7fd7836c6f332bb2933569e566a0d6c4cbed74", 532 | "shasum": "" 533 | }, 534 | "require": { 535 | "php": "^7.2 || ^8.0" 536 | }, 537 | "type": "library", 538 | "autoload": { 539 | "classmap": [ 540 | "src/" 541 | ] 542 | }, 543 | "notification-url": "https://packagist.org/downloads/", 544 | "license": [ 545 | "BSD-3-Clause" 546 | ], 547 | "authors": [ 548 | { 549 | "name": "Arne Blankerts", 550 | "email": "arne@blankerts.de", 551 | "role": "Developer" 552 | }, 553 | { 554 | "name": "Sebastian Heuer", 555 | "email": "sebastian@phpeople.de", 556 | "role": "Developer" 557 | }, 558 | { 559 | "name": "Sebastian Bergmann", 560 | "email": "sebastian@phpunit.de", 561 | "role": "Developer" 562 | } 563 | ], 564 | "description": "Library for handling version information and constraints", 565 | "support": { 566 | "issues": "https://github.com/phar-io/version/issues", 567 | "source": "https://github.com/phar-io/version/tree/3.2.1" 568 | }, 569 | "time": "2022-02-21T01:04:05+00:00" 570 | }, 571 | { 572 | "name": "phpunit/php-code-coverage", 573 | "version": "9.2.29", 574 | "source": { 575 | "type": "git", 576 | "url": "https://github.com/sebastianbergmann/php-code-coverage.git", 577 | "reference": "6a3a87ac2bbe33b25042753df8195ba4aa534c76" 578 | }, 579 | "dist": { 580 | "type": "zip", 581 | "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/6a3a87ac2bbe33b25042753df8195ba4aa534c76", 582 | "reference": "6a3a87ac2bbe33b25042753df8195ba4aa534c76", 583 | "shasum": "" 584 | }, 585 | "require": { 586 | "ext-dom": "*", 587 | "ext-libxml": "*", 588 | "ext-xmlwriter": "*", 589 | "nikic/php-parser": "^4.15", 590 | "php": ">=7.3", 591 | "phpunit/php-file-iterator": "^3.0.3", 592 | "phpunit/php-text-template": "^2.0.2", 593 | "sebastian/code-unit-reverse-lookup": "^2.0.2", 594 | "sebastian/complexity": "^2.0", 595 | "sebastian/environment": "^5.1.2", 596 | "sebastian/lines-of-code": "^1.0.3", 597 | "sebastian/version": "^3.0.1", 598 | "theseer/tokenizer": "^1.2.0" 599 | }, 600 | "require-dev": { 601 | "phpunit/phpunit": "^9.3" 602 | }, 603 | "suggest": { 604 | "ext-pcov": "PHP extension that provides line coverage", 605 | "ext-xdebug": "PHP extension that provides line coverage as well as branch and path coverage" 606 | }, 607 | "type": "library", 608 | "extra": { 609 | "branch-alias": { 610 | "dev-master": "9.2-dev" 611 | } 612 | }, 613 | "autoload": { 614 | "classmap": [ 615 | "src/" 616 | ] 617 | }, 618 | "notification-url": "https://packagist.org/downloads/", 619 | "license": [ 620 | "BSD-3-Clause" 621 | ], 622 | "authors": [ 623 | { 624 | "name": "Sebastian Bergmann", 625 | "email": "sebastian@phpunit.de", 626 | "role": "lead" 627 | } 628 | ], 629 | "description": "Library that provides collection, processing, and rendering functionality for PHP code coverage information.", 630 | "homepage": "https://github.com/sebastianbergmann/php-code-coverage", 631 | "keywords": [ 632 | "coverage", 633 | "testing", 634 | "xunit" 635 | ], 636 | "support": { 637 | "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", 638 | "security": "https://github.com/sebastianbergmann/php-code-coverage/security/policy", 639 | "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.29" 640 | }, 641 | "funding": [ 642 | { 643 | "url": "https://github.com/sebastianbergmann", 644 | "type": "github" 645 | } 646 | ], 647 | "time": "2023-09-19T04:57:46+00:00" 648 | }, 649 | { 650 | "name": "phpunit/php-file-iterator", 651 | "version": "3.0.6", 652 | "source": { 653 | "type": "git", 654 | "url": "https://github.com/sebastianbergmann/php-file-iterator.git", 655 | "reference": "cf1c2e7c203ac650e352f4cc675a7021e7d1b3cf" 656 | }, 657 | "dist": { 658 | "type": "zip", 659 | "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/cf1c2e7c203ac650e352f4cc675a7021e7d1b3cf", 660 | "reference": "cf1c2e7c203ac650e352f4cc675a7021e7d1b3cf", 661 | "shasum": "" 662 | }, 663 | "require": { 664 | "php": ">=7.3" 665 | }, 666 | "require-dev": { 667 | "phpunit/phpunit": "^9.3" 668 | }, 669 | "type": "library", 670 | "extra": { 671 | "branch-alias": { 672 | "dev-master": "3.0-dev" 673 | } 674 | }, 675 | "autoload": { 676 | "classmap": [ 677 | "src/" 678 | ] 679 | }, 680 | "notification-url": "https://packagist.org/downloads/", 681 | "license": [ 682 | "BSD-3-Clause" 683 | ], 684 | "authors": [ 685 | { 686 | "name": "Sebastian Bergmann", 687 | "email": "sebastian@phpunit.de", 688 | "role": "lead" 689 | } 690 | ], 691 | "description": "FilterIterator implementation that filters files based on a list of suffixes.", 692 | "homepage": "https://github.com/sebastianbergmann/php-file-iterator/", 693 | "keywords": [ 694 | "filesystem", 695 | "iterator" 696 | ], 697 | "support": { 698 | "issues": "https://github.com/sebastianbergmann/php-file-iterator/issues", 699 | "source": "https://github.com/sebastianbergmann/php-file-iterator/tree/3.0.6" 700 | }, 701 | "funding": [ 702 | { 703 | "url": "https://github.com/sebastianbergmann", 704 | "type": "github" 705 | } 706 | ], 707 | "time": "2021-12-02T12:48:52+00:00" 708 | }, 709 | { 710 | "name": "phpunit/php-invoker", 711 | "version": "3.1.1", 712 | "source": { 713 | "type": "git", 714 | "url": "https://github.com/sebastianbergmann/php-invoker.git", 715 | "reference": "5a10147d0aaf65b58940a0b72f71c9ac0423cc67" 716 | }, 717 | "dist": { 718 | "type": "zip", 719 | "url": "https://api.github.com/repos/sebastianbergmann/php-invoker/zipball/5a10147d0aaf65b58940a0b72f71c9ac0423cc67", 720 | "reference": "5a10147d0aaf65b58940a0b72f71c9ac0423cc67", 721 | "shasum": "" 722 | }, 723 | "require": { 724 | "php": ">=7.3" 725 | }, 726 | "require-dev": { 727 | "ext-pcntl": "*", 728 | "phpunit/phpunit": "^9.3" 729 | }, 730 | "suggest": { 731 | "ext-pcntl": "*" 732 | }, 733 | "type": "library", 734 | "extra": { 735 | "branch-alias": { 736 | "dev-master": "3.1-dev" 737 | } 738 | }, 739 | "autoload": { 740 | "classmap": [ 741 | "src/" 742 | ] 743 | }, 744 | "notification-url": "https://packagist.org/downloads/", 745 | "license": [ 746 | "BSD-3-Clause" 747 | ], 748 | "authors": [ 749 | { 750 | "name": "Sebastian Bergmann", 751 | "email": "sebastian@phpunit.de", 752 | "role": "lead" 753 | } 754 | ], 755 | "description": "Invoke callables with a timeout", 756 | "homepage": "https://github.com/sebastianbergmann/php-invoker/", 757 | "keywords": [ 758 | "process" 759 | ], 760 | "support": { 761 | "issues": "https://github.com/sebastianbergmann/php-invoker/issues", 762 | "source": "https://github.com/sebastianbergmann/php-invoker/tree/3.1.1" 763 | }, 764 | "funding": [ 765 | { 766 | "url": "https://github.com/sebastianbergmann", 767 | "type": "github" 768 | } 769 | ], 770 | "time": "2020-09-28T05:58:55+00:00" 771 | }, 772 | { 773 | "name": "phpunit/php-text-template", 774 | "version": "2.0.4", 775 | "source": { 776 | "type": "git", 777 | "url": "https://github.com/sebastianbergmann/php-text-template.git", 778 | "reference": "5da5f67fc95621df9ff4c4e5a84d6a8a2acf7c28" 779 | }, 780 | "dist": { 781 | "type": "zip", 782 | "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/5da5f67fc95621df9ff4c4e5a84d6a8a2acf7c28", 783 | "reference": "5da5f67fc95621df9ff4c4e5a84d6a8a2acf7c28", 784 | "shasum": "" 785 | }, 786 | "require": { 787 | "php": ">=7.3" 788 | }, 789 | "require-dev": { 790 | "phpunit/phpunit": "^9.3" 791 | }, 792 | "type": "library", 793 | "extra": { 794 | "branch-alias": { 795 | "dev-master": "2.0-dev" 796 | } 797 | }, 798 | "autoload": { 799 | "classmap": [ 800 | "src/" 801 | ] 802 | }, 803 | "notification-url": "https://packagist.org/downloads/", 804 | "license": [ 805 | "BSD-3-Clause" 806 | ], 807 | "authors": [ 808 | { 809 | "name": "Sebastian Bergmann", 810 | "email": "sebastian@phpunit.de", 811 | "role": "lead" 812 | } 813 | ], 814 | "description": "Simple template engine.", 815 | "homepage": "https://github.com/sebastianbergmann/php-text-template/", 816 | "keywords": [ 817 | "template" 818 | ], 819 | "support": { 820 | "issues": "https://github.com/sebastianbergmann/php-text-template/issues", 821 | "source": "https://github.com/sebastianbergmann/php-text-template/tree/2.0.4" 822 | }, 823 | "funding": [ 824 | { 825 | "url": "https://github.com/sebastianbergmann", 826 | "type": "github" 827 | } 828 | ], 829 | "time": "2020-10-26T05:33:50+00:00" 830 | }, 831 | { 832 | "name": "phpunit/php-timer", 833 | "version": "5.0.3", 834 | "source": { 835 | "type": "git", 836 | "url": "https://github.com/sebastianbergmann/php-timer.git", 837 | "reference": "5a63ce20ed1b5bf577850e2c4e87f4aa902afbd2" 838 | }, 839 | "dist": { 840 | "type": "zip", 841 | "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/5a63ce20ed1b5bf577850e2c4e87f4aa902afbd2", 842 | "reference": "5a63ce20ed1b5bf577850e2c4e87f4aa902afbd2", 843 | "shasum": "" 844 | }, 845 | "require": { 846 | "php": ">=7.3" 847 | }, 848 | "require-dev": { 849 | "phpunit/phpunit": "^9.3" 850 | }, 851 | "type": "library", 852 | "extra": { 853 | "branch-alias": { 854 | "dev-master": "5.0-dev" 855 | } 856 | }, 857 | "autoload": { 858 | "classmap": [ 859 | "src/" 860 | ] 861 | }, 862 | "notification-url": "https://packagist.org/downloads/", 863 | "license": [ 864 | "BSD-3-Clause" 865 | ], 866 | "authors": [ 867 | { 868 | "name": "Sebastian Bergmann", 869 | "email": "sebastian@phpunit.de", 870 | "role": "lead" 871 | } 872 | ], 873 | "description": "Utility class for timing", 874 | "homepage": "https://github.com/sebastianbergmann/php-timer/", 875 | "keywords": [ 876 | "timer" 877 | ], 878 | "support": { 879 | "issues": "https://github.com/sebastianbergmann/php-timer/issues", 880 | "source": "https://github.com/sebastianbergmann/php-timer/tree/5.0.3" 881 | }, 882 | "funding": [ 883 | { 884 | "url": "https://github.com/sebastianbergmann", 885 | "type": "github" 886 | } 887 | ], 888 | "time": "2020-10-26T13:16:10+00:00" 889 | }, 890 | { 891 | "name": "phpunit/phpunit", 892 | "version": "9.6.13", 893 | "source": { 894 | "type": "git", 895 | "url": "https://github.com/sebastianbergmann/phpunit.git", 896 | "reference": "f3d767f7f9e191eab4189abe41ab37797e30b1be" 897 | }, 898 | "dist": { 899 | "type": "zip", 900 | "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/f3d767f7f9e191eab4189abe41ab37797e30b1be", 901 | "reference": "f3d767f7f9e191eab4189abe41ab37797e30b1be", 902 | "shasum": "" 903 | }, 904 | "require": { 905 | "doctrine/instantiator": "^1.3.1 || ^2", 906 | "ext-dom": "*", 907 | "ext-json": "*", 908 | "ext-libxml": "*", 909 | "ext-mbstring": "*", 910 | "ext-xml": "*", 911 | "ext-xmlwriter": "*", 912 | "myclabs/deep-copy": "^1.10.1", 913 | "phar-io/manifest": "^2.0.3", 914 | "phar-io/version": "^3.0.2", 915 | "php": ">=7.3", 916 | "phpunit/php-code-coverage": "^9.2.28", 917 | "phpunit/php-file-iterator": "^3.0.5", 918 | "phpunit/php-invoker": "^3.1.1", 919 | "phpunit/php-text-template": "^2.0.3", 920 | "phpunit/php-timer": "^5.0.2", 921 | "sebastian/cli-parser": "^1.0.1", 922 | "sebastian/code-unit": "^1.0.6", 923 | "sebastian/comparator": "^4.0.8", 924 | "sebastian/diff": "^4.0.3", 925 | "sebastian/environment": "^5.1.3", 926 | "sebastian/exporter": "^4.0.5", 927 | "sebastian/global-state": "^5.0.1", 928 | "sebastian/object-enumerator": "^4.0.3", 929 | "sebastian/resource-operations": "^3.0.3", 930 | "sebastian/type": "^3.2", 931 | "sebastian/version": "^3.0.2" 932 | }, 933 | "suggest": { 934 | "ext-soap": "To be able to generate mocks based on WSDL files", 935 | "ext-xdebug": "PHP extension that provides line coverage as well as branch and path coverage" 936 | }, 937 | "bin": [ 938 | "phpunit" 939 | ], 940 | "type": "library", 941 | "extra": { 942 | "branch-alias": { 943 | "dev-master": "9.6-dev" 944 | } 945 | }, 946 | "autoload": { 947 | "files": [ 948 | "src/Framework/Assert/Functions.php" 949 | ], 950 | "classmap": [ 951 | "src/" 952 | ] 953 | }, 954 | "notification-url": "https://packagist.org/downloads/", 955 | "license": [ 956 | "BSD-3-Clause" 957 | ], 958 | "authors": [ 959 | { 960 | "name": "Sebastian Bergmann", 961 | "email": "sebastian@phpunit.de", 962 | "role": "lead" 963 | } 964 | ], 965 | "description": "The PHP Unit Testing framework.", 966 | "homepage": "https://phpunit.de/", 967 | "keywords": [ 968 | "phpunit", 969 | "testing", 970 | "xunit" 971 | ], 972 | "support": { 973 | "issues": "https://github.com/sebastianbergmann/phpunit/issues", 974 | "security": "https://github.com/sebastianbergmann/phpunit/security/policy", 975 | "source": "https://github.com/sebastianbergmann/phpunit/tree/9.6.13" 976 | }, 977 | "funding": [ 978 | { 979 | "url": "https://phpunit.de/sponsors.html", 980 | "type": "custom" 981 | }, 982 | { 983 | "url": "https://github.com/sebastianbergmann", 984 | "type": "github" 985 | }, 986 | { 987 | "url": "https://tidelift.com/funding/github/packagist/phpunit/phpunit", 988 | "type": "tidelift" 989 | } 990 | ], 991 | "time": "2023-09-19T05:39:22+00:00" 992 | }, 993 | { 994 | "name": "sebastian/cli-parser", 995 | "version": "1.0.1", 996 | "source": { 997 | "type": "git", 998 | "url": "https://github.com/sebastianbergmann/cli-parser.git", 999 | "reference": "442e7c7e687e42adc03470c7b668bc4b2402c0b2" 1000 | }, 1001 | "dist": { 1002 | "type": "zip", 1003 | "url": "https://api.github.com/repos/sebastianbergmann/cli-parser/zipball/442e7c7e687e42adc03470c7b668bc4b2402c0b2", 1004 | "reference": "442e7c7e687e42adc03470c7b668bc4b2402c0b2", 1005 | "shasum": "" 1006 | }, 1007 | "require": { 1008 | "php": ">=7.3" 1009 | }, 1010 | "require-dev": { 1011 | "phpunit/phpunit": "^9.3" 1012 | }, 1013 | "type": "library", 1014 | "extra": { 1015 | "branch-alias": { 1016 | "dev-master": "1.0-dev" 1017 | } 1018 | }, 1019 | "autoload": { 1020 | "classmap": [ 1021 | "src/" 1022 | ] 1023 | }, 1024 | "notification-url": "https://packagist.org/downloads/", 1025 | "license": [ 1026 | "BSD-3-Clause" 1027 | ], 1028 | "authors": [ 1029 | { 1030 | "name": "Sebastian Bergmann", 1031 | "email": "sebastian@phpunit.de", 1032 | "role": "lead" 1033 | } 1034 | ], 1035 | "description": "Library for parsing CLI options", 1036 | "homepage": "https://github.com/sebastianbergmann/cli-parser", 1037 | "support": { 1038 | "issues": "https://github.com/sebastianbergmann/cli-parser/issues", 1039 | "source": "https://github.com/sebastianbergmann/cli-parser/tree/1.0.1" 1040 | }, 1041 | "funding": [ 1042 | { 1043 | "url": "https://github.com/sebastianbergmann", 1044 | "type": "github" 1045 | } 1046 | ], 1047 | "time": "2020-09-28T06:08:49+00:00" 1048 | }, 1049 | { 1050 | "name": "sebastian/code-unit", 1051 | "version": "1.0.8", 1052 | "source": { 1053 | "type": "git", 1054 | "url": "https://github.com/sebastianbergmann/code-unit.git", 1055 | "reference": "1fc9f64c0927627ef78ba436c9b17d967e68e120" 1056 | }, 1057 | "dist": { 1058 | "type": "zip", 1059 | "url": "https://api.github.com/repos/sebastianbergmann/code-unit/zipball/1fc9f64c0927627ef78ba436c9b17d967e68e120", 1060 | "reference": "1fc9f64c0927627ef78ba436c9b17d967e68e120", 1061 | "shasum": "" 1062 | }, 1063 | "require": { 1064 | "php": ">=7.3" 1065 | }, 1066 | "require-dev": { 1067 | "phpunit/phpunit": "^9.3" 1068 | }, 1069 | "type": "library", 1070 | "extra": { 1071 | "branch-alias": { 1072 | "dev-master": "1.0-dev" 1073 | } 1074 | }, 1075 | "autoload": { 1076 | "classmap": [ 1077 | "src/" 1078 | ] 1079 | }, 1080 | "notification-url": "https://packagist.org/downloads/", 1081 | "license": [ 1082 | "BSD-3-Clause" 1083 | ], 1084 | "authors": [ 1085 | { 1086 | "name": "Sebastian Bergmann", 1087 | "email": "sebastian@phpunit.de", 1088 | "role": "lead" 1089 | } 1090 | ], 1091 | "description": "Collection of value objects that represent the PHP code units", 1092 | "homepage": "https://github.com/sebastianbergmann/code-unit", 1093 | "support": { 1094 | "issues": "https://github.com/sebastianbergmann/code-unit/issues", 1095 | "source": "https://github.com/sebastianbergmann/code-unit/tree/1.0.8" 1096 | }, 1097 | "funding": [ 1098 | { 1099 | "url": "https://github.com/sebastianbergmann", 1100 | "type": "github" 1101 | } 1102 | ], 1103 | "time": "2020-10-26T13:08:54+00:00" 1104 | }, 1105 | { 1106 | "name": "sebastian/code-unit-reverse-lookup", 1107 | "version": "2.0.3", 1108 | "source": { 1109 | "type": "git", 1110 | "url": "https://github.com/sebastianbergmann/code-unit-reverse-lookup.git", 1111 | "reference": "ac91f01ccec49fb77bdc6fd1e548bc70f7faa3e5" 1112 | }, 1113 | "dist": { 1114 | "type": "zip", 1115 | "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/ac91f01ccec49fb77bdc6fd1e548bc70f7faa3e5", 1116 | "reference": "ac91f01ccec49fb77bdc6fd1e548bc70f7faa3e5", 1117 | "shasum": "" 1118 | }, 1119 | "require": { 1120 | "php": ">=7.3" 1121 | }, 1122 | "require-dev": { 1123 | "phpunit/phpunit": "^9.3" 1124 | }, 1125 | "type": "library", 1126 | "extra": { 1127 | "branch-alias": { 1128 | "dev-master": "2.0-dev" 1129 | } 1130 | }, 1131 | "autoload": { 1132 | "classmap": [ 1133 | "src/" 1134 | ] 1135 | }, 1136 | "notification-url": "https://packagist.org/downloads/", 1137 | "license": [ 1138 | "BSD-3-Clause" 1139 | ], 1140 | "authors": [ 1141 | { 1142 | "name": "Sebastian Bergmann", 1143 | "email": "sebastian@phpunit.de" 1144 | } 1145 | ], 1146 | "description": "Looks up which function or method a line of code belongs to", 1147 | "homepage": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/", 1148 | "support": { 1149 | "issues": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/issues", 1150 | "source": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/tree/2.0.3" 1151 | }, 1152 | "funding": [ 1153 | { 1154 | "url": "https://github.com/sebastianbergmann", 1155 | "type": "github" 1156 | } 1157 | ], 1158 | "time": "2020-09-28T05:30:19+00:00" 1159 | }, 1160 | { 1161 | "name": "sebastian/comparator", 1162 | "version": "4.0.8", 1163 | "source": { 1164 | "type": "git", 1165 | "url": "https://github.com/sebastianbergmann/comparator.git", 1166 | "reference": "fa0f136dd2334583309d32b62544682ee972b51a" 1167 | }, 1168 | "dist": { 1169 | "type": "zip", 1170 | "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/fa0f136dd2334583309d32b62544682ee972b51a", 1171 | "reference": "fa0f136dd2334583309d32b62544682ee972b51a", 1172 | "shasum": "" 1173 | }, 1174 | "require": { 1175 | "php": ">=7.3", 1176 | "sebastian/diff": "^4.0", 1177 | "sebastian/exporter": "^4.0" 1178 | }, 1179 | "require-dev": { 1180 | "phpunit/phpunit": "^9.3" 1181 | }, 1182 | "type": "library", 1183 | "extra": { 1184 | "branch-alias": { 1185 | "dev-master": "4.0-dev" 1186 | } 1187 | }, 1188 | "autoload": { 1189 | "classmap": [ 1190 | "src/" 1191 | ] 1192 | }, 1193 | "notification-url": "https://packagist.org/downloads/", 1194 | "license": [ 1195 | "BSD-3-Clause" 1196 | ], 1197 | "authors": [ 1198 | { 1199 | "name": "Sebastian Bergmann", 1200 | "email": "sebastian@phpunit.de" 1201 | }, 1202 | { 1203 | "name": "Jeff Welch", 1204 | "email": "whatthejeff@gmail.com" 1205 | }, 1206 | { 1207 | "name": "Volker Dusch", 1208 | "email": "github@wallbash.com" 1209 | }, 1210 | { 1211 | "name": "Bernhard Schussek", 1212 | "email": "bschussek@2bepublished.at" 1213 | } 1214 | ], 1215 | "description": "Provides the functionality to compare PHP values for equality", 1216 | "homepage": "https://github.com/sebastianbergmann/comparator", 1217 | "keywords": [ 1218 | "comparator", 1219 | "compare", 1220 | "equality" 1221 | ], 1222 | "support": { 1223 | "issues": "https://github.com/sebastianbergmann/comparator/issues", 1224 | "source": "https://github.com/sebastianbergmann/comparator/tree/4.0.8" 1225 | }, 1226 | "funding": [ 1227 | { 1228 | "url": "https://github.com/sebastianbergmann", 1229 | "type": "github" 1230 | } 1231 | ], 1232 | "time": "2022-09-14T12:41:17+00:00" 1233 | }, 1234 | { 1235 | "name": "sebastian/complexity", 1236 | "version": "2.0.2", 1237 | "source": { 1238 | "type": "git", 1239 | "url": "https://github.com/sebastianbergmann/complexity.git", 1240 | "reference": "739b35e53379900cc9ac327b2147867b8b6efd88" 1241 | }, 1242 | "dist": { 1243 | "type": "zip", 1244 | "url": "https://api.github.com/repos/sebastianbergmann/complexity/zipball/739b35e53379900cc9ac327b2147867b8b6efd88", 1245 | "reference": "739b35e53379900cc9ac327b2147867b8b6efd88", 1246 | "shasum": "" 1247 | }, 1248 | "require": { 1249 | "nikic/php-parser": "^4.7", 1250 | "php": ">=7.3" 1251 | }, 1252 | "require-dev": { 1253 | "phpunit/phpunit": "^9.3" 1254 | }, 1255 | "type": "library", 1256 | "extra": { 1257 | "branch-alias": { 1258 | "dev-master": "2.0-dev" 1259 | } 1260 | }, 1261 | "autoload": { 1262 | "classmap": [ 1263 | "src/" 1264 | ] 1265 | }, 1266 | "notification-url": "https://packagist.org/downloads/", 1267 | "license": [ 1268 | "BSD-3-Clause" 1269 | ], 1270 | "authors": [ 1271 | { 1272 | "name": "Sebastian Bergmann", 1273 | "email": "sebastian@phpunit.de", 1274 | "role": "lead" 1275 | } 1276 | ], 1277 | "description": "Library for calculating the complexity of PHP code units", 1278 | "homepage": "https://github.com/sebastianbergmann/complexity", 1279 | "support": { 1280 | "issues": "https://github.com/sebastianbergmann/complexity/issues", 1281 | "source": "https://github.com/sebastianbergmann/complexity/tree/2.0.2" 1282 | }, 1283 | "funding": [ 1284 | { 1285 | "url": "https://github.com/sebastianbergmann", 1286 | "type": "github" 1287 | } 1288 | ], 1289 | "time": "2020-10-26T15:52:27+00:00" 1290 | }, 1291 | { 1292 | "name": "sebastian/diff", 1293 | "version": "4.0.5", 1294 | "source": { 1295 | "type": "git", 1296 | "url": "https://github.com/sebastianbergmann/diff.git", 1297 | "reference": "74be17022044ebaaecfdf0c5cd504fc9cd5a7131" 1298 | }, 1299 | "dist": { 1300 | "type": "zip", 1301 | "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/74be17022044ebaaecfdf0c5cd504fc9cd5a7131", 1302 | "reference": "74be17022044ebaaecfdf0c5cd504fc9cd5a7131", 1303 | "shasum": "" 1304 | }, 1305 | "require": { 1306 | "php": ">=7.3" 1307 | }, 1308 | "require-dev": { 1309 | "phpunit/phpunit": "^9.3", 1310 | "symfony/process": "^4.2 || ^5" 1311 | }, 1312 | "type": "library", 1313 | "extra": { 1314 | "branch-alias": { 1315 | "dev-master": "4.0-dev" 1316 | } 1317 | }, 1318 | "autoload": { 1319 | "classmap": [ 1320 | "src/" 1321 | ] 1322 | }, 1323 | "notification-url": "https://packagist.org/downloads/", 1324 | "license": [ 1325 | "BSD-3-Clause" 1326 | ], 1327 | "authors": [ 1328 | { 1329 | "name": "Sebastian Bergmann", 1330 | "email": "sebastian@phpunit.de" 1331 | }, 1332 | { 1333 | "name": "Kore Nordmann", 1334 | "email": "mail@kore-nordmann.de" 1335 | } 1336 | ], 1337 | "description": "Diff implementation", 1338 | "homepage": "https://github.com/sebastianbergmann/diff", 1339 | "keywords": [ 1340 | "diff", 1341 | "udiff", 1342 | "unidiff", 1343 | "unified diff" 1344 | ], 1345 | "support": { 1346 | "issues": "https://github.com/sebastianbergmann/diff/issues", 1347 | "source": "https://github.com/sebastianbergmann/diff/tree/4.0.5" 1348 | }, 1349 | "funding": [ 1350 | { 1351 | "url": "https://github.com/sebastianbergmann", 1352 | "type": "github" 1353 | } 1354 | ], 1355 | "time": "2023-05-07T05:35:17+00:00" 1356 | }, 1357 | { 1358 | "name": "sebastian/environment", 1359 | "version": "5.1.5", 1360 | "source": { 1361 | "type": "git", 1362 | "url": "https://github.com/sebastianbergmann/environment.git", 1363 | "reference": "830c43a844f1f8d5b7a1f6d6076b784454d8b7ed" 1364 | }, 1365 | "dist": { 1366 | "type": "zip", 1367 | "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/830c43a844f1f8d5b7a1f6d6076b784454d8b7ed", 1368 | "reference": "830c43a844f1f8d5b7a1f6d6076b784454d8b7ed", 1369 | "shasum": "" 1370 | }, 1371 | "require": { 1372 | "php": ">=7.3" 1373 | }, 1374 | "require-dev": { 1375 | "phpunit/phpunit": "^9.3" 1376 | }, 1377 | "suggest": { 1378 | "ext-posix": "*" 1379 | }, 1380 | "type": "library", 1381 | "extra": { 1382 | "branch-alias": { 1383 | "dev-master": "5.1-dev" 1384 | } 1385 | }, 1386 | "autoload": { 1387 | "classmap": [ 1388 | "src/" 1389 | ] 1390 | }, 1391 | "notification-url": "https://packagist.org/downloads/", 1392 | "license": [ 1393 | "BSD-3-Clause" 1394 | ], 1395 | "authors": [ 1396 | { 1397 | "name": "Sebastian Bergmann", 1398 | "email": "sebastian@phpunit.de" 1399 | } 1400 | ], 1401 | "description": "Provides functionality to handle HHVM/PHP environments", 1402 | "homepage": "http://www.github.com/sebastianbergmann/environment", 1403 | "keywords": [ 1404 | "Xdebug", 1405 | "environment", 1406 | "hhvm" 1407 | ], 1408 | "support": { 1409 | "issues": "https://github.com/sebastianbergmann/environment/issues", 1410 | "source": "https://github.com/sebastianbergmann/environment/tree/5.1.5" 1411 | }, 1412 | "funding": [ 1413 | { 1414 | "url": "https://github.com/sebastianbergmann", 1415 | "type": "github" 1416 | } 1417 | ], 1418 | "time": "2023-02-03T06:03:51+00:00" 1419 | }, 1420 | { 1421 | "name": "sebastian/exporter", 1422 | "version": "4.0.5", 1423 | "source": { 1424 | "type": "git", 1425 | "url": "https://github.com/sebastianbergmann/exporter.git", 1426 | "reference": "ac230ed27f0f98f597c8a2b6eb7ac563af5e5b9d" 1427 | }, 1428 | "dist": { 1429 | "type": "zip", 1430 | "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/ac230ed27f0f98f597c8a2b6eb7ac563af5e5b9d", 1431 | "reference": "ac230ed27f0f98f597c8a2b6eb7ac563af5e5b9d", 1432 | "shasum": "" 1433 | }, 1434 | "require": { 1435 | "php": ">=7.3", 1436 | "sebastian/recursion-context": "^4.0" 1437 | }, 1438 | "require-dev": { 1439 | "ext-mbstring": "*", 1440 | "phpunit/phpunit": "^9.3" 1441 | }, 1442 | "type": "library", 1443 | "extra": { 1444 | "branch-alias": { 1445 | "dev-master": "4.0-dev" 1446 | } 1447 | }, 1448 | "autoload": { 1449 | "classmap": [ 1450 | "src/" 1451 | ] 1452 | }, 1453 | "notification-url": "https://packagist.org/downloads/", 1454 | "license": [ 1455 | "BSD-3-Clause" 1456 | ], 1457 | "authors": [ 1458 | { 1459 | "name": "Sebastian Bergmann", 1460 | "email": "sebastian@phpunit.de" 1461 | }, 1462 | { 1463 | "name": "Jeff Welch", 1464 | "email": "whatthejeff@gmail.com" 1465 | }, 1466 | { 1467 | "name": "Volker Dusch", 1468 | "email": "github@wallbash.com" 1469 | }, 1470 | { 1471 | "name": "Adam Harvey", 1472 | "email": "aharvey@php.net" 1473 | }, 1474 | { 1475 | "name": "Bernhard Schussek", 1476 | "email": "bschussek@gmail.com" 1477 | } 1478 | ], 1479 | "description": "Provides the functionality to export PHP variables for visualization", 1480 | "homepage": "https://www.github.com/sebastianbergmann/exporter", 1481 | "keywords": [ 1482 | "export", 1483 | "exporter" 1484 | ], 1485 | "support": { 1486 | "issues": "https://github.com/sebastianbergmann/exporter/issues", 1487 | "source": "https://github.com/sebastianbergmann/exporter/tree/4.0.5" 1488 | }, 1489 | "funding": [ 1490 | { 1491 | "url": "https://github.com/sebastianbergmann", 1492 | "type": "github" 1493 | } 1494 | ], 1495 | "time": "2022-09-14T06:03:37+00:00" 1496 | }, 1497 | { 1498 | "name": "sebastian/global-state", 1499 | "version": "5.0.6", 1500 | "source": { 1501 | "type": "git", 1502 | "url": "https://github.com/sebastianbergmann/global-state.git", 1503 | "reference": "bde739e7565280bda77be70044ac1047bc007e34" 1504 | }, 1505 | "dist": { 1506 | "type": "zip", 1507 | "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/bde739e7565280bda77be70044ac1047bc007e34", 1508 | "reference": "bde739e7565280bda77be70044ac1047bc007e34", 1509 | "shasum": "" 1510 | }, 1511 | "require": { 1512 | "php": ">=7.3", 1513 | "sebastian/object-reflector": "^2.0", 1514 | "sebastian/recursion-context": "^4.0" 1515 | }, 1516 | "require-dev": { 1517 | "ext-dom": "*", 1518 | "phpunit/phpunit": "^9.3" 1519 | }, 1520 | "suggest": { 1521 | "ext-uopz": "*" 1522 | }, 1523 | "type": "library", 1524 | "extra": { 1525 | "branch-alias": { 1526 | "dev-master": "5.0-dev" 1527 | } 1528 | }, 1529 | "autoload": { 1530 | "classmap": [ 1531 | "src/" 1532 | ] 1533 | }, 1534 | "notification-url": "https://packagist.org/downloads/", 1535 | "license": [ 1536 | "BSD-3-Clause" 1537 | ], 1538 | "authors": [ 1539 | { 1540 | "name": "Sebastian Bergmann", 1541 | "email": "sebastian@phpunit.de" 1542 | } 1543 | ], 1544 | "description": "Snapshotting of global state", 1545 | "homepage": "http://www.github.com/sebastianbergmann/global-state", 1546 | "keywords": [ 1547 | "global state" 1548 | ], 1549 | "support": { 1550 | "issues": "https://github.com/sebastianbergmann/global-state/issues", 1551 | "source": "https://github.com/sebastianbergmann/global-state/tree/5.0.6" 1552 | }, 1553 | "funding": [ 1554 | { 1555 | "url": "https://github.com/sebastianbergmann", 1556 | "type": "github" 1557 | } 1558 | ], 1559 | "time": "2023-08-02T09:26:13+00:00" 1560 | }, 1561 | { 1562 | "name": "sebastian/lines-of-code", 1563 | "version": "1.0.3", 1564 | "source": { 1565 | "type": "git", 1566 | "url": "https://github.com/sebastianbergmann/lines-of-code.git", 1567 | "reference": "c1c2e997aa3146983ed888ad08b15470a2e22ecc" 1568 | }, 1569 | "dist": { 1570 | "type": "zip", 1571 | "url": "https://api.github.com/repos/sebastianbergmann/lines-of-code/zipball/c1c2e997aa3146983ed888ad08b15470a2e22ecc", 1572 | "reference": "c1c2e997aa3146983ed888ad08b15470a2e22ecc", 1573 | "shasum": "" 1574 | }, 1575 | "require": { 1576 | "nikic/php-parser": "^4.6", 1577 | "php": ">=7.3" 1578 | }, 1579 | "require-dev": { 1580 | "phpunit/phpunit": "^9.3" 1581 | }, 1582 | "type": "library", 1583 | "extra": { 1584 | "branch-alias": { 1585 | "dev-master": "1.0-dev" 1586 | } 1587 | }, 1588 | "autoload": { 1589 | "classmap": [ 1590 | "src/" 1591 | ] 1592 | }, 1593 | "notification-url": "https://packagist.org/downloads/", 1594 | "license": [ 1595 | "BSD-3-Clause" 1596 | ], 1597 | "authors": [ 1598 | { 1599 | "name": "Sebastian Bergmann", 1600 | "email": "sebastian@phpunit.de", 1601 | "role": "lead" 1602 | } 1603 | ], 1604 | "description": "Library for counting the lines of code in PHP source code", 1605 | "homepage": "https://github.com/sebastianbergmann/lines-of-code", 1606 | "support": { 1607 | "issues": "https://github.com/sebastianbergmann/lines-of-code/issues", 1608 | "source": "https://github.com/sebastianbergmann/lines-of-code/tree/1.0.3" 1609 | }, 1610 | "funding": [ 1611 | { 1612 | "url": "https://github.com/sebastianbergmann", 1613 | "type": "github" 1614 | } 1615 | ], 1616 | "time": "2020-11-28T06:42:11+00:00" 1617 | }, 1618 | { 1619 | "name": "sebastian/object-enumerator", 1620 | "version": "4.0.4", 1621 | "source": { 1622 | "type": "git", 1623 | "url": "https://github.com/sebastianbergmann/object-enumerator.git", 1624 | "reference": "5c9eeac41b290a3712d88851518825ad78f45c71" 1625 | }, 1626 | "dist": { 1627 | "type": "zip", 1628 | "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/5c9eeac41b290a3712d88851518825ad78f45c71", 1629 | "reference": "5c9eeac41b290a3712d88851518825ad78f45c71", 1630 | "shasum": "" 1631 | }, 1632 | "require": { 1633 | "php": ">=7.3", 1634 | "sebastian/object-reflector": "^2.0", 1635 | "sebastian/recursion-context": "^4.0" 1636 | }, 1637 | "require-dev": { 1638 | "phpunit/phpunit": "^9.3" 1639 | }, 1640 | "type": "library", 1641 | "extra": { 1642 | "branch-alias": { 1643 | "dev-master": "4.0-dev" 1644 | } 1645 | }, 1646 | "autoload": { 1647 | "classmap": [ 1648 | "src/" 1649 | ] 1650 | }, 1651 | "notification-url": "https://packagist.org/downloads/", 1652 | "license": [ 1653 | "BSD-3-Clause" 1654 | ], 1655 | "authors": [ 1656 | { 1657 | "name": "Sebastian Bergmann", 1658 | "email": "sebastian@phpunit.de" 1659 | } 1660 | ], 1661 | "description": "Traverses array structures and object graphs to enumerate all referenced objects", 1662 | "homepage": "https://github.com/sebastianbergmann/object-enumerator/", 1663 | "support": { 1664 | "issues": "https://github.com/sebastianbergmann/object-enumerator/issues", 1665 | "source": "https://github.com/sebastianbergmann/object-enumerator/tree/4.0.4" 1666 | }, 1667 | "funding": [ 1668 | { 1669 | "url": "https://github.com/sebastianbergmann", 1670 | "type": "github" 1671 | } 1672 | ], 1673 | "time": "2020-10-26T13:12:34+00:00" 1674 | }, 1675 | { 1676 | "name": "sebastian/object-reflector", 1677 | "version": "2.0.4", 1678 | "source": { 1679 | "type": "git", 1680 | "url": "https://github.com/sebastianbergmann/object-reflector.git", 1681 | "reference": "b4f479ebdbf63ac605d183ece17d8d7fe49c15c7" 1682 | }, 1683 | "dist": { 1684 | "type": "zip", 1685 | "url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/b4f479ebdbf63ac605d183ece17d8d7fe49c15c7", 1686 | "reference": "b4f479ebdbf63ac605d183ece17d8d7fe49c15c7", 1687 | "shasum": "" 1688 | }, 1689 | "require": { 1690 | "php": ">=7.3" 1691 | }, 1692 | "require-dev": { 1693 | "phpunit/phpunit": "^9.3" 1694 | }, 1695 | "type": "library", 1696 | "extra": { 1697 | "branch-alias": { 1698 | "dev-master": "2.0-dev" 1699 | } 1700 | }, 1701 | "autoload": { 1702 | "classmap": [ 1703 | "src/" 1704 | ] 1705 | }, 1706 | "notification-url": "https://packagist.org/downloads/", 1707 | "license": [ 1708 | "BSD-3-Clause" 1709 | ], 1710 | "authors": [ 1711 | { 1712 | "name": "Sebastian Bergmann", 1713 | "email": "sebastian@phpunit.de" 1714 | } 1715 | ], 1716 | "description": "Allows reflection of object attributes, including inherited and non-public ones", 1717 | "homepage": "https://github.com/sebastianbergmann/object-reflector/", 1718 | "support": { 1719 | "issues": "https://github.com/sebastianbergmann/object-reflector/issues", 1720 | "source": "https://github.com/sebastianbergmann/object-reflector/tree/2.0.4" 1721 | }, 1722 | "funding": [ 1723 | { 1724 | "url": "https://github.com/sebastianbergmann", 1725 | "type": "github" 1726 | } 1727 | ], 1728 | "time": "2020-10-26T13:14:26+00:00" 1729 | }, 1730 | { 1731 | "name": "sebastian/recursion-context", 1732 | "version": "4.0.5", 1733 | "source": { 1734 | "type": "git", 1735 | "url": "https://github.com/sebastianbergmann/recursion-context.git", 1736 | "reference": "e75bd0f07204fec2a0af9b0f3cfe97d05f92efc1" 1737 | }, 1738 | "dist": { 1739 | "type": "zip", 1740 | "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/e75bd0f07204fec2a0af9b0f3cfe97d05f92efc1", 1741 | "reference": "e75bd0f07204fec2a0af9b0f3cfe97d05f92efc1", 1742 | "shasum": "" 1743 | }, 1744 | "require": { 1745 | "php": ">=7.3" 1746 | }, 1747 | "require-dev": { 1748 | "phpunit/phpunit": "^9.3" 1749 | }, 1750 | "type": "library", 1751 | "extra": { 1752 | "branch-alias": { 1753 | "dev-master": "4.0-dev" 1754 | } 1755 | }, 1756 | "autoload": { 1757 | "classmap": [ 1758 | "src/" 1759 | ] 1760 | }, 1761 | "notification-url": "https://packagist.org/downloads/", 1762 | "license": [ 1763 | "BSD-3-Clause" 1764 | ], 1765 | "authors": [ 1766 | { 1767 | "name": "Sebastian Bergmann", 1768 | "email": "sebastian@phpunit.de" 1769 | }, 1770 | { 1771 | "name": "Jeff Welch", 1772 | "email": "whatthejeff@gmail.com" 1773 | }, 1774 | { 1775 | "name": "Adam Harvey", 1776 | "email": "aharvey@php.net" 1777 | } 1778 | ], 1779 | "description": "Provides functionality to recursively process PHP variables", 1780 | "homepage": "https://github.com/sebastianbergmann/recursion-context", 1781 | "support": { 1782 | "issues": "https://github.com/sebastianbergmann/recursion-context/issues", 1783 | "source": "https://github.com/sebastianbergmann/recursion-context/tree/4.0.5" 1784 | }, 1785 | "funding": [ 1786 | { 1787 | "url": "https://github.com/sebastianbergmann", 1788 | "type": "github" 1789 | } 1790 | ], 1791 | "time": "2023-02-03T06:07:39+00:00" 1792 | }, 1793 | { 1794 | "name": "sebastian/resource-operations", 1795 | "version": "3.0.3", 1796 | "source": { 1797 | "type": "git", 1798 | "url": "https://github.com/sebastianbergmann/resource-operations.git", 1799 | "reference": "0f4443cb3a1d92ce809899753bc0d5d5a8dd19a8" 1800 | }, 1801 | "dist": { 1802 | "type": "zip", 1803 | "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/0f4443cb3a1d92ce809899753bc0d5d5a8dd19a8", 1804 | "reference": "0f4443cb3a1d92ce809899753bc0d5d5a8dd19a8", 1805 | "shasum": "" 1806 | }, 1807 | "require": { 1808 | "php": ">=7.3" 1809 | }, 1810 | "require-dev": { 1811 | "phpunit/phpunit": "^9.0" 1812 | }, 1813 | "type": "library", 1814 | "extra": { 1815 | "branch-alias": { 1816 | "dev-master": "3.0-dev" 1817 | } 1818 | }, 1819 | "autoload": { 1820 | "classmap": [ 1821 | "src/" 1822 | ] 1823 | }, 1824 | "notification-url": "https://packagist.org/downloads/", 1825 | "license": [ 1826 | "BSD-3-Clause" 1827 | ], 1828 | "authors": [ 1829 | { 1830 | "name": "Sebastian Bergmann", 1831 | "email": "sebastian@phpunit.de" 1832 | } 1833 | ], 1834 | "description": "Provides a list of PHP built-in functions that operate on resources", 1835 | "homepage": "https://www.github.com/sebastianbergmann/resource-operations", 1836 | "support": { 1837 | "issues": "https://github.com/sebastianbergmann/resource-operations/issues", 1838 | "source": "https://github.com/sebastianbergmann/resource-operations/tree/3.0.3" 1839 | }, 1840 | "funding": [ 1841 | { 1842 | "url": "https://github.com/sebastianbergmann", 1843 | "type": "github" 1844 | } 1845 | ], 1846 | "time": "2020-09-28T06:45:17+00:00" 1847 | }, 1848 | { 1849 | "name": "sebastian/type", 1850 | "version": "3.2.1", 1851 | "source": { 1852 | "type": "git", 1853 | "url": "https://github.com/sebastianbergmann/type.git", 1854 | "reference": "75e2c2a32f5e0b3aef905b9ed0b179b953b3d7c7" 1855 | }, 1856 | "dist": { 1857 | "type": "zip", 1858 | "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/75e2c2a32f5e0b3aef905b9ed0b179b953b3d7c7", 1859 | "reference": "75e2c2a32f5e0b3aef905b9ed0b179b953b3d7c7", 1860 | "shasum": "" 1861 | }, 1862 | "require": { 1863 | "php": ">=7.3" 1864 | }, 1865 | "require-dev": { 1866 | "phpunit/phpunit": "^9.5" 1867 | }, 1868 | "type": "library", 1869 | "extra": { 1870 | "branch-alias": { 1871 | "dev-master": "3.2-dev" 1872 | } 1873 | }, 1874 | "autoload": { 1875 | "classmap": [ 1876 | "src/" 1877 | ] 1878 | }, 1879 | "notification-url": "https://packagist.org/downloads/", 1880 | "license": [ 1881 | "BSD-3-Clause" 1882 | ], 1883 | "authors": [ 1884 | { 1885 | "name": "Sebastian Bergmann", 1886 | "email": "sebastian@phpunit.de", 1887 | "role": "lead" 1888 | } 1889 | ], 1890 | "description": "Collection of value objects that represent the types of the PHP type system", 1891 | "homepage": "https://github.com/sebastianbergmann/type", 1892 | "support": { 1893 | "issues": "https://github.com/sebastianbergmann/type/issues", 1894 | "source": "https://github.com/sebastianbergmann/type/tree/3.2.1" 1895 | }, 1896 | "funding": [ 1897 | { 1898 | "url": "https://github.com/sebastianbergmann", 1899 | "type": "github" 1900 | } 1901 | ], 1902 | "time": "2023-02-03T06:13:03+00:00" 1903 | }, 1904 | { 1905 | "name": "sebastian/version", 1906 | "version": "3.0.2", 1907 | "source": { 1908 | "type": "git", 1909 | "url": "https://github.com/sebastianbergmann/version.git", 1910 | "reference": "c6c1022351a901512170118436c764e473f6de8c" 1911 | }, 1912 | "dist": { 1913 | "type": "zip", 1914 | "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/c6c1022351a901512170118436c764e473f6de8c", 1915 | "reference": "c6c1022351a901512170118436c764e473f6de8c", 1916 | "shasum": "" 1917 | }, 1918 | "require": { 1919 | "php": ">=7.3" 1920 | }, 1921 | "type": "library", 1922 | "extra": { 1923 | "branch-alias": { 1924 | "dev-master": "3.0-dev" 1925 | } 1926 | }, 1927 | "autoload": { 1928 | "classmap": [ 1929 | "src/" 1930 | ] 1931 | }, 1932 | "notification-url": "https://packagist.org/downloads/", 1933 | "license": [ 1934 | "BSD-3-Clause" 1935 | ], 1936 | "authors": [ 1937 | { 1938 | "name": "Sebastian Bergmann", 1939 | "email": "sebastian@phpunit.de", 1940 | "role": "lead" 1941 | } 1942 | ], 1943 | "description": "Library that helps with managing the version number of Git-hosted PHP projects", 1944 | "homepage": "https://github.com/sebastianbergmann/version", 1945 | "support": { 1946 | "issues": "https://github.com/sebastianbergmann/version/issues", 1947 | "source": "https://github.com/sebastianbergmann/version/tree/3.0.2" 1948 | }, 1949 | "funding": [ 1950 | { 1951 | "url": "https://github.com/sebastianbergmann", 1952 | "type": "github" 1953 | } 1954 | ], 1955 | "time": "2020-09-28T06:39:44+00:00" 1956 | }, 1957 | { 1958 | "name": "squizlabs/php_codesniffer", 1959 | "version": "3.6.2", 1960 | "source": { 1961 | "type": "git", 1962 | "url": "https://github.com/squizlabs/PHP_CodeSniffer.git", 1963 | "reference": "5e4e71592f69da17871dba6e80dd51bce74a351a" 1964 | }, 1965 | "dist": { 1966 | "type": "zip", 1967 | "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/5e4e71592f69da17871dba6e80dd51bce74a351a", 1968 | "reference": "5e4e71592f69da17871dba6e80dd51bce74a351a", 1969 | "shasum": "" 1970 | }, 1971 | "require": { 1972 | "ext-simplexml": "*", 1973 | "ext-tokenizer": "*", 1974 | "ext-xmlwriter": "*", 1975 | "php": ">=5.4.0" 1976 | }, 1977 | "require-dev": { 1978 | "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0" 1979 | }, 1980 | "bin": [ 1981 | "bin/phpcs", 1982 | "bin/phpcbf" 1983 | ], 1984 | "type": "library", 1985 | "extra": { 1986 | "branch-alias": { 1987 | "dev-master": "3.x-dev" 1988 | } 1989 | }, 1990 | "notification-url": "https://packagist.org/downloads/", 1991 | "license": [ 1992 | "BSD-3-Clause" 1993 | ], 1994 | "authors": [ 1995 | { 1996 | "name": "Greg Sherwood", 1997 | "role": "lead" 1998 | } 1999 | ], 2000 | "description": "PHP_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.", 2001 | "homepage": "https://github.com/squizlabs/PHP_CodeSniffer", 2002 | "keywords": [ 2003 | "phpcs", 2004 | "standards" 2005 | ], 2006 | "support": { 2007 | "issues": "https://github.com/squizlabs/PHP_CodeSniffer/issues", 2008 | "source": "https://github.com/squizlabs/PHP_CodeSniffer", 2009 | "wiki": "https://github.com/squizlabs/PHP_CodeSniffer/wiki" 2010 | }, 2011 | "time": "2021-12-12T21:44:58+00:00" 2012 | }, 2013 | { 2014 | "name": "theseer/tokenizer", 2015 | "version": "1.2.1", 2016 | "source": { 2017 | "type": "git", 2018 | "url": "https://github.com/theseer/tokenizer.git", 2019 | "reference": "34a41e998c2183e22995f158c581e7b5e755ab9e" 2020 | }, 2021 | "dist": { 2022 | "type": "zip", 2023 | "url": "https://api.github.com/repos/theseer/tokenizer/zipball/34a41e998c2183e22995f158c581e7b5e755ab9e", 2024 | "reference": "34a41e998c2183e22995f158c581e7b5e755ab9e", 2025 | "shasum": "" 2026 | }, 2027 | "require": { 2028 | "ext-dom": "*", 2029 | "ext-tokenizer": "*", 2030 | "ext-xmlwriter": "*", 2031 | "php": "^7.2 || ^8.0" 2032 | }, 2033 | "type": "library", 2034 | "autoload": { 2035 | "classmap": [ 2036 | "src/" 2037 | ] 2038 | }, 2039 | "notification-url": "https://packagist.org/downloads/", 2040 | "license": [ 2041 | "BSD-3-Clause" 2042 | ], 2043 | "authors": [ 2044 | { 2045 | "name": "Arne Blankerts", 2046 | "email": "arne@blankerts.de", 2047 | "role": "Developer" 2048 | } 2049 | ], 2050 | "description": "A small library for converting tokenized PHP source code into XML and potentially other formats", 2051 | "support": { 2052 | "issues": "https://github.com/theseer/tokenizer/issues", 2053 | "source": "https://github.com/theseer/tokenizer/tree/1.2.1" 2054 | }, 2055 | "funding": [ 2056 | { 2057 | "url": "https://github.com/theseer", 2058 | "type": "github" 2059 | } 2060 | ], 2061 | "time": "2021-07-28T10:34:58+00:00" 2062 | } 2063 | ], 2064 | "aliases": [], 2065 | "minimum-stability": "stable", 2066 | "stability-flags": [], 2067 | "prefer-stable": false, 2068 | "prefer-lowest": false, 2069 | "platform": { 2070 | "ext-curl": "*", 2071 | "ext-intl": "*", 2072 | "lib-curl": ">=7.43.0", 2073 | "php": ">=7.3.0" 2074 | }, 2075 | "platform-dev": [], 2076 | "plugin-api-version": "2.6.0" 2077 | } 2078 | -------------------------------------------------------------------------------- /phpunit.xml.dist.bak: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | ./tests 7 | 8 | 9 | 10 | 11 | ./src 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /src/CheckIfDead.php: -------------------------------------------------------------------------------- 1 | curlTimeoutNoBody = (int)$curlTimeoutNoBody; 135 | $this->curlTimeoutFull = (int)$curlTimeoutFull; 136 | $this->customUserAgent = $userAgent; 137 | $this->queuedTesting = (bool)$sequentialTests; 138 | $this->verbose = (bool)$verbose; 139 | 140 | self::$socks5Host = $socks5Host; 141 | if ( $socks5Port === false ) { 142 | // If we are using TOR defaults, check OS to determine which defaults to use. 143 | if ( substr( php_uname(), 0, 7 ) == "Windows" ) { 144 | self::$socks5Port = 9150; 145 | } else { 146 | self::$socks5Port = 9050; 147 | } 148 | } else { 149 | self::$socks5Port = $socks5Port; 150 | } 151 | } 152 | 153 | /** 154 | * Check if a single URL is dead by performing a curl request 155 | * 156 | * @param string $url URL to check 157 | * @return bool|null Returns null if curl is unable to initialize. 158 | * Otherwise returns true (dead) or false (alive). 159 | */ 160 | public function isLinkDead( $url ) { 161 | $deadVal = $this->areLinksDead( [ $url ] ); 162 | $deadVal = $deadVal[$url]; 163 | 164 | return $deadVal; 165 | } 166 | 167 | /** 168 | * Check an array of links 169 | * 170 | * @param array $urls Array of URLs we are checking 171 | * @return array|null Returns null if curl is unable to initialize. 172 | * Otherwise returns an array in which each key is a URL and each value is 173 | * true (dead) or false (alive). 174 | */ 175 | public function areLinksDead( $urls ) { 176 | // Run TOR check if not yet initialized 177 | if ( is_null( self::$torEnabled ) ) { 178 | // Check to see if we have an environment that supports TOR 179 | if ( $this->verbose ) { 180 | echo "Testing for TOR readiness..."; 181 | } 182 | $testURL = "https://check.torproject.org"; 183 | // Prepare test 184 | $ch = curl_init(); 185 | // Get appropriate curl options 186 | $options = $this->getCurlOptions( 187 | $this->sanitizeURL( $testURL ), 188 | true, 189 | true 190 | ); 191 | // Force Tor settings onto the options 192 | $options[CURLOPT_PROXY] = self::$socks5Host . ":" . self::$socks5Port; 193 | $options[CURLOPT_PROXYTYPE] = CURLPROXY_SOCKS5_HOSTNAME; 194 | $options[CURLOPT_HTTPPROXYTUNNEL] = true; 195 | curl_setopt_array( 196 | $ch, 197 | $options 198 | ); 199 | $data = curl_exec( $ch ); 200 | if ( strpos( $data, "This browser is configured to use Tor." ) !== false ) { 201 | self::$torEnabled = true; 202 | } else { 203 | self::$torEnabled = false; 204 | } 205 | curl_close( $ch ); 206 | if ( $this->verbose ) { 207 | if ( self::$torEnabled ) { 208 | echo "Ready\n"; 209 | echo "TOR requests can be made in this environment\n"; 210 | } else { 211 | echo "Not ready\n"; 212 | echo "TOR requests will be ignored\n"; 213 | } 214 | } 215 | } 216 | 217 | // Create multiple curl handle 218 | $this->errors = []; 219 | $this->details = []; 220 | $multicurl_resource = curl_multi_init(); 221 | if ( $multicurl_resource === false ) { 222 | return null; 223 | } 224 | $deadLinks = []; 225 | $this->queueRequests( $urls ); 226 | if ( $this->verbose === true ) { 227 | if ( count( $this->curlQueue ) > 1 ) { 228 | echo "Delaying one or more links!\n"; 229 | } 230 | } 231 | foreach ( $this->curlQueue as $urls ) { 232 | $curl_instances = []; 233 | // Array of URLs we want to send in for a full check 234 | $fullCheckURLs = []; 235 | // Maps the destination URL to the requested URL in case we followed a redirect 236 | $fullCheckURLMap = []; 237 | // Set HTTP version for full check URLs 238 | $httpVersions = []; 239 | foreach ( $urls as $id => $url ) { 240 | $requestType = $this->getRequestType( $this->sanitizeURL( $url ) ); 241 | if ( !in_array( $requestType, [ "UNSUPPORTED", "BAD URL" ] ) ) { 242 | $curl_instances[$id] = curl_init(); 243 | if ( $curl_instances[$id] === false ) { 244 | return null; 245 | } 246 | // Get appropriate curl options 247 | curl_setopt_array( 248 | $curl_instances[$id], 249 | $this->getCurlOptions( $this->sanitizeURL( $url ), false, $this->isOnion( $url ) ) 250 | ); 251 | // Add the instance handle 252 | curl_multi_add_handle( $multicurl_resource, $curl_instances[$id] ); 253 | } elseif ( $this->verbose === true ) { 254 | if ( $requestType == "UNSUPPORTED" ) echo "$url is not supported!\n"; 255 | else echo "$url is malformed!\n"; 256 | } 257 | if ( $requestType == "BAD URL" ) { 258 | $deadLinks[$url] = true; 259 | $this->errors[$url] = "MALFORMED URL"; 260 | $this->details[$url] = null; 261 | } 262 | } 263 | // Let's do the curl operations 264 | $active = null; 265 | do { 266 | $mrc = curl_multi_exec( $multicurl_resource, $active ); 267 | } while ( $mrc == CURLM_CALL_MULTI_PERFORM ); 268 | while ( $active && $mrc == CURLM_OK ) { 269 | if ( curl_multi_select( $multicurl_resource ) == -1 ) { 270 | // To prevent CPU spike 271 | usleep( 100 ); 272 | } 273 | do { 274 | $mrc = curl_multi_exec( $multicurl_resource, $active ); 275 | } while ( $mrc == CURLM_CALL_MULTI_PERFORM ); 276 | } 277 | // Let's process our curl results and extract the useful information 278 | foreach ( $urls as $id => $url ) { 279 | if ( isset( $curl_instances[$id] ) ) { 280 | $this->details[$url] = $headers = curl_getinfo( $curl_instances[$id] ); 281 | $error = curl_errno( $curl_instances[$id] ); 282 | $errormsg = curl_error( $curl_instances[$id] ); 283 | $curlInfo = [ 284 | 'http_code' => $headers['http_code'], 285 | 'effective_url' => $headers['url'], 286 | 'curl_error' => $error, 287 | 'curl_error_msg' => $errormsg, 288 | 'url' => $this->sanitizeURL( $url ), 289 | 'rawurl' => $url, 290 | 'http_version' => curl_getinfo( $curl_instances[$id], CURLINFO_HTTP_VERSION ) 291 | ]; 292 | if ( isset( $headers['total_time_us'] ) ) { 293 | $curlInfo['exec_time'] = $headers['total_time_us']; 294 | } elseif ( isset( $headers['total_time'] ) ) { 295 | $curlInfo['exec_time'] = $headers['total_time'] * 1000000; 296 | } else { 297 | $curlInfo['exec_time'] = 1000000; 298 | } 299 | // Remove each of the individual handles 300 | curl_multi_remove_handle( $multicurl_resource, $curl_instances[$id] ); 301 | $curl_instances[$id] = null; 302 | // Deduce whether the site is dead or alive 303 | $deadLinks[$url] = $this->processCurlResults( $curlInfo ); 304 | if ( $this->verbose === true ) { 305 | if ( $deadLinks[$url] === true ) { 306 | echo "$url is DEAD!\n"; 307 | } 308 | if ( $deadLinks[$url] === false ) { 309 | echo "$url is ALIVE!\n"; 310 | } 311 | } 312 | // If we got back a null, we should do a full page request 313 | if ( is_null( $deadLinks[$url] ) ) { 314 | $fullCheckURLs[] = $curlInfo['url']; 315 | $httpVersions[] = $curlInfo['http_version']; 316 | if ( $url != $curlInfo['url'] ) { 317 | $fullCheckURLMap[$url] = $curlInfo['url']; 318 | } 319 | } 320 | } else { 321 | if ( !isset( $deadLinks[$url] ) ) $deadLinks[$url] = null; 322 | if ( $this->verbose === true ) { 323 | echo "Something went wrong with $url!\n"; 324 | } 325 | } 326 | } 327 | // Do full page requests for URLs that returned null 328 | if ( !empty( $fullCheckURLs ) ) { 329 | if ( $this->verbose === true ) { 330 | echo "Running a full check on:\n"; 331 | foreach ( $fullCheckURLs as $url ) { 332 | echo "\t$url\n"; 333 | } 334 | } 335 | $results = $this->performFullRequest( $fullCheckURLs, $httpVersions ); 336 | if ( $this->verbose === true ) { 337 | foreach ( $results as $url => $result ) { 338 | if ( $result === true ) { 339 | echo "$url is DEAD!\n"; 340 | } 341 | if ( $result === false ) { 342 | echo "$url is ALIVE!\n"; 343 | } 344 | } 345 | } 346 | // Merge back results from full requests into our deadlinks array 347 | $deadLinks = array_merge( $deadLinks, $results ); 348 | // Use map to change destination URL back to the requested URL 349 | foreach ( $fullCheckURLMap as $requested => $destination ) { 350 | $deadLinks[$requested] = $deadLinks[$destination]; 351 | $this->details[$requested] = $this->details[$destination]; 352 | $this->snapshots[$requested] = $this->snapshots[$destination]; 353 | if ( isset( $this->errors[$destination] ) ) { 354 | $this->errors[$requested] = $this->errors[$destination]; 355 | unset( $this->errors[$destination] ); 356 | } 357 | unset ( 358 | $deadLinks[$destination], 359 | $this->details[$destination], 360 | $this->snapshots[$destination] ); 361 | } 362 | } 363 | if ( count( $this->curlQueue ) > 1 ) { 364 | sleep( 1 ); 365 | } 366 | } 367 | // Close resource 368 | curl_multi_close( $multicurl_resource ); 369 | 370 | return $deadLinks; 371 | } 372 | 373 | /** 374 | * Perform a complete text request, not just for headers 375 | * 376 | * @param array $urls URLs we are checking 377 | * @return array with params 'error':curl error number and 378 | * 'result':true(dead)/false(alive) for each element 379 | */ 380 | protected function performFullRequest( $urls, $httpVersions ) { 381 | // Create multiple curl handle 382 | $multicurl_resource = curl_multi_init(); 383 | if ( $multicurl_resource === false ) { 384 | return false; 385 | } 386 | $curl_instances = []; 387 | $deadlinks = []; 388 | foreach ( $urls as $id => $url ) { 389 | $curl_instances[$id] = curl_init(); 390 | if ( $curl_instances[$id] === false ) { 391 | return false; 392 | } 393 | // Get appropriate curl options 394 | curl_setopt_array( 395 | $curl_instances[$id], 396 | $this->getCurlOptions( 397 | $this->sanitizeURL( $url, false, true ), 398 | true, 399 | $this->isOnion( $url ), $httpVersions[$id] 400 | ) 401 | ); 402 | // Add the instance handle 403 | curl_multi_add_handle( $multicurl_resource, $curl_instances[$id] ); 404 | } 405 | // Let's do the CURL operations 406 | $active = null; 407 | do { 408 | $mrc = curl_multi_exec( $multicurl_resource, $active ); 409 | } while ( $mrc == CURLM_CALL_MULTI_PERFORM ); 410 | while ( $active && $mrc == CURLM_OK ) { 411 | if ( curl_multi_select( $multicurl_resource ) == -1 ) { 412 | // To prevent CPU spike 413 | usleep( 100 ); 414 | } 415 | do { 416 | $mrc = curl_multi_exec( $multicurl_resource, $active ); 417 | } while ( $mrc == CURLM_CALL_MULTI_PERFORM ); 418 | } 419 | // Let's process our curl results and extract the useful information 420 | foreach ( $urls as $id => $url ) { 421 | $this->details[$url] = $headers = curl_getinfo( $curl_instances[$id] ); 422 | $this->snapshots[$url] = curl_multi_getcontent( $curl_instances[$id] ); 423 | $error = curl_errno( $curl_instances[$id] ); 424 | $errormsg = curl_error( $curl_instances[$id] ); 425 | $curlInfo = [ 426 | 'http_code' => $headers['http_code'], 427 | 'effective_url' => $headers['url'], 428 | 'curl_error' => $error, 429 | 'curl_error_msg' => $errormsg, 430 | 'url' => $this->sanitizeURL( $url ), 431 | 'rawurl' => $url, 432 | 'http_version' => curl_getinfo( $curl_instances[$id], CURLINFO_HTTP_VERSION ) 433 | ]; 434 | if ( isset( $headers['total_time_us'] ) ) { 435 | $curlInfo['exec_time'] = $headers['total_time_us']; 436 | } elseif ( isset( $headers['total_time'] ) ) { 437 | $curlInfo['exec_time'] = $headers['total_time'] * 1000000; 438 | } else { 439 | $curlInfo['exec_time'] = 1000000; 440 | } 441 | // Remove each of the individual handles 442 | curl_multi_remove_handle( $multicurl_resource, $curl_instances[$id] ); 443 | $deadlinks[$url] = $this->processCurlResults( $curlInfo, true ); 444 | } 445 | // Close resource 446 | curl_multi_close( $multicurl_resource ); 447 | 448 | return $deadlinks; 449 | } 450 | 451 | /** 452 | * Queue up the URLs creating time-delays between URLs with the same domain. 453 | * 454 | * @param array $urls All the URLs being tested 455 | */ 456 | protected function queueRequests( $urls ) { 457 | $this->curlQueue = []; 458 | if ( $this->queuedTesting === false ) { 459 | $this->curlQueue[] = $urls; 460 | 461 | return; 462 | } 463 | foreach ( $urls as $url ) { 464 | $parsedParts = $this->parseURL( $url ); 465 | if ( $parsedParts === false ) { 466 | $parsedParts = []; 467 | $parsedParts['host'] = "empty"; 468 | } 469 | $domain = $parsedParts['host']; 470 | $queuedUrl = false; 471 | $queueIndex = -1; 472 | foreach ( $this->curlQueue as $queueIndex => $urlList ) { 473 | if ( $queuedUrl === false && !isset( $urlList[$domain] ) ) { 474 | $this->curlQueue[$queueIndex][$domain] = $url; 475 | $queuedUrl = true; 476 | } 477 | } 478 | if ( $queuedUrl === false ) { 479 | $this->curlQueue[++$queueIndex][$domain] = $url; 480 | } 481 | } 482 | } 483 | 484 | /** 485 | * Get CURL options 486 | * 487 | * @param $url String URL we are testing against 488 | * @param bool $full Is this a request for the full page? 489 | * @param bool $tor Is this request being routed through TOR? 490 | * @return array Options for curl 491 | */ 492 | protected function getCurlOptions( $url, $full = false, $tor = false, $httpVersion = CURL_HTTP_VERSION_NONE ) { 493 | $requestType = $this->getRequestType( $url ); 494 | if ( $requestType == "MMS" ) { 495 | $url = str_ireplace( "mms://", "rtsp://", $url ); 496 | } 497 | $options = [ 498 | CURLOPT_URL => $url, 499 | CURLOPT_HEADER => 1, 500 | CURLOPT_RETURNTRANSFER => true, 501 | CURLOPT_AUTOREFERER => true, 502 | CURLOPT_FOLLOWLOCATION => true, 503 | CURLOPT_TIMEOUT => $this->curlTimeoutNoBody, 504 | CURLOPT_SSL_VERIFYPEER => false, 505 | CURLOPT_COOKIEJAR => sys_get_temp_dir() . "checkifdead.cookies.dat", 506 | CURLOPT_HTTP_VERSION => $httpVersion, 507 | CURLINFO_HEADER_OUT => 1 508 | ]; 509 | if ( $requestType == "RTSP" || $requestType == "MMS" ) { 510 | $header = []; 511 | $options[CURLOPT_USERAGENT] = $this->mediaAgent; 512 | } elseif ( $requestType != "FTP" ) { 513 | // Properly handle HTTP version 514 | // Emulate a web browser request but make it accept more than a web browser 515 | if ( in_array( $httpVersion, [ CURL_HTTP_VERSION_1_0, CURL_HTTP_VERSION_1_1, CURL_HTTP_VERSION_NONE ] ) ) { 516 | $header = [ 517 | // @codingStandardsIgnoreStart Line exceeds 100 characters 518 | 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9', 519 | // @codingStandardsIgnoreEnd 520 | 'Upgrade-Insecure-Requests: 1', 521 | 'Cache-Control: max-age=0', 522 | 'Connection: keep-alive', 523 | 'Keep-Alive: 300', 524 | 'Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7', 525 | 'Accept-Language: en-US,en;q=0.9,de;q=0.8', 526 | 'Pragma: ' 527 | ]; 528 | } elseif ( in_array( $httpVersion, [ CURL_HTTP_VERSION_2, CURL_HTTP_VERSION_2_0, CURL_HTTP_VERSION_2_PRIOR_KNOWLEDGE, CURL_HTTP_VERSION_2TLS ] ) ) { 529 | $header = [ 530 | // @codingStandardsIgnoreStart Line exceeds 100 characters 531 | 'accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9', 532 | // @codingStandardsIgnoreEnd 533 | 'upgrade-insecure-requests: 1', 534 | 'cache-control: max-age=0', 535 | 'connection: keep-alive', 536 | 'keep-alive: 300', 537 | 'accept-charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7', 538 | 'accept-language: en-US,en;q=0.9,de;q=0.8', 539 | 'dnt: 1' 540 | ]; 541 | if ( $requestType == "HTTPS" ) { 542 | $header[] = 'sec-ch-ua: "Google Chrome";v="105", "Not)A;Brand";v="8", "Chromium";v="105"'; 543 | $header[] = 'sec-ch-ua-mobile: ?0'; 544 | $header[] = 'sec-ch-ua-platform: "' . $this->getRequestPlatform() . '"'; 545 | $header[] = 'sec-fetch-dest: document'; 546 | $header[] = 'sec-fetch-mode: navigate'; 547 | $header[] = 'sec-fetch-site: none'; 548 | $header[] = 'sec-fetch-user: ?1'; 549 | } 550 | } 551 | if ( $this->customUserAgent === false ) { 552 | $options[CURLOPT_USERAGENT] = $this->userAgent; 553 | } else { 554 | $options[CURLOPT_USERAGENT] = $this->customUserAgent; 555 | } 556 | } 557 | if ( $requestType == 'FTP' ) { 558 | $options[CURLOPT_FTP_USE_EPRT] = 1; 559 | $options[CURLOPT_FTP_USE_EPSV] = 1; 560 | $options[CURLOPT_FTPSSLAUTH] = CURLFTPAUTH_DEFAULT; 561 | $options[CURLOPT_FTP_FILEMETHOD] = CURLFTPMETHOD_SINGLECWD; 562 | if ( $full ) { 563 | // Set CURLOPT_USERPWD for anonymous FTP login 564 | $options[CURLOPT_USERPWD] = "anonymous:anonymous@domain.com"; 565 | } 566 | } elseif ( $full ) { 567 | // Extend timeout since we are requesting the full body 568 | $options[CURLOPT_TIMEOUT] = $this->curlTimeoutFull; 569 | $options[CURLOPT_HTTPHEADER] = $header; 570 | if ( $requestType != "MMS" && $requestType != "RTSP" ) { 571 | $options[CURLOPT_ENCODING] = 'gzip, deflate, br'; 572 | } 573 | $options[CURLOPT_USERAGENT] = $this->userAgent; 574 | } else { 575 | $options[CURLOPT_NOBODY] = 1; 576 | } 577 | if ( $tor && self::$torEnabled ) { 578 | $options[CURLOPT_PROXY] = self::$socks5Host . ":" . self::$socks5Port; 579 | $options[CURLOPT_PROXYTYPE] = CURLPROXY_SOCKS5_HOSTNAME; 580 | $options[CURLOPT_HTTPPROXYTUNNEL] = true; 581 | } else { 582 | $options[CURLOPT_PROXYTYPE] = CURLPROXY_HTTP; 583 | } 584 | 585 | return $options; 586 | } 587 | 588 | /** 589 | * Get platform 590 | * 591 | * @return string "Android", "Chrome OS", "Chromium OS", "iOS", "Linux", "macOS", "Windows", or "Unknown" 592 | */ 593 | protected function getRequestPlatform() { 594 | switch ( PHP_OS ) { 595 | case "WINNT": 596 | case "Windows_NT": 597 | case "CYGWIN_NT-5.1": 598 | case "CYGWIN_NT-6.1": 599 | case "CYGWIN_NT-6.1-WOW64": 600 | case "CYGWIN_NT-10.0": 601 | case "MINGW32_NT-6.1": 602 | case "MINGW64_NT-6.1": 603 | case "MSYS_NT-6.1": 604 | case "MSYS_NT-6.1": 605 | case "MS-DOS": 606 | case "WindowsNT": 607 | case "UWIN-W7": 608 | return "Windows"; 609 | case "GNU": 610 | case "GNU/kFreeBSD": 611 | case "DragonFly": 612 | case "Linux": 613 | case "FreeBSD": 614 | case "HP-UX": 615 | case "AIX": 616 | case "Interix": 617 | case "IRIX": 618 | case "IRIX64": 619 | case "MidnightBSD": 620 | case "Minix": 621 | case "NetBSD": 622 | case "OpenBSD": 623 | case "QNX": 624 | case "ReliantUNIX-Y": 625 | case "SINIX-Y": 626 | case "SunOS": 627 | case "OSF1": 628 | case "ULTRIX": 629 | case "SCO_SV": 630 | case "TrueNAS": 631 | case "FreeNAS": 632 | case "UnixWare": 633 | return "Linux"; 634 | case "Darwin": 635 | return "macOS"; 636 | default: 637 | return "Unknown"; 638 | } 639 | } 640 | 641 | /** 642 | * Get request type 643 | * 644 | * @param $url String URL we are checking against 645 | * @return string "FTP", "MMS", "RTSP", "HTTP", or "UNSUPPORTED" 646 | */ 647 | protected function getRequestType( $url ) { 648 | if ( $this->isOnion( $url ) && !self::$torEnabled ) { 649 | return "UNSUPPORTED"; 650 | } 651 | 652 | if ( $url === false ) { 653 | return "BAD URL"; 654 | } 655 | 656 | switch ( strtolower( parse_url( $url, PHP_URL_SCHEME ) ) ) { 657 | case "ftp": 658 | return "FTP"; 659 | case "mms": 660 | return "MMS"; 661 | case "rtsp": 662 | return "RTSP"; 663 | case "http": 664 | return "HTTP"; 665 | case "https": 666 | return "HTTPS"; 667 | case "": 668 | return "BAD URL"; 669 | default: 670 | return "UNSUPPORTED"; 671 | } 672 | } 673 | 674 | /** 675 | * Check if TOR is needed to access url 676 | * 677 | * @param $url String URL we are checking against 678 | * @return bool True if it's an Onion URL 679 | */ 680 | protected function isOnion( $url ) { 681 | if ( $url === false ) { 682 | return false; 683 | } 684 | 685 | $domain = strtolower( parse_url( $url, PHP_URL_HOST ) ); 686 | if ( substr( $domain, -6 ) == ".onion" ) { 687 | return true; 688 | } else { 689 | return false; 690 | } 691 | } 692 | 693 | /** 694 | * Process the returned headers 695 | * 696 | * @param array $curlInfo Array with values: returned headers, error number, URL checked for 697 | * @param bool $full Was this a request for the full page? 698 | * @return bool|null Returns true if dead, false if alive, null if uncertain 699 | */ 700 | protected function processCurlResults( $curlInfo, $full = false, $httpVersion = CURL_HTTP_VERSION_NONE ) { 701 | // Determine if we are using FTP or HTTP 702 | $requestType = $this->getRequestType( $curlInfo['url'] ); 703 | // Get HTTP code returned 704 | $httpCode = $curlInfo['http_code']; 705 | // Get final URL 706 | $effectiveUrl = $curlInfo['effective_url']; 707 | // Clean final url, removing scheme, 'www', and trailing slash 708 | $effectiveUrlClean = $this->cleanURL( $effectiveUrl ); 709 | // Get an array of possible root urls 710 | $possibleRoots = $this->getDomainRoots( $curlInfo['url'] ); 711 | // Let's check and see if we are HTTP version mismatched 712 | $httpVersionMismatch = $httpVersion != $curlInfo['http_version']; 713 | if ( $httpCode >= 400 && $httpCode < 600 ) { 714 | if ( $full ) { 715 | $this->errors[$curlInfo['rawurl']] = "RESPONSE CODE: $httpCode"; 716 | 717 | return true; 718 | } else { 719 | // Some servers don't support NOBODY requests, so if an HTTP error code 720 | // is returned, we'll check the URL again with a full page request. 721 | return null; 722 | } 723 | } 724 | // Check for error messages in redirected URL string 725 | if ( strpos( $effectiveUrlClean, '/404.htm' ) !== false || 726 | strpos( $effectiveUrlClean, '/404/' ) !== false || 727 | stripos( $effectiveUrlClean, 'notfound' ) !== false 728 | ) { 729 | if ( $full ) { 730 | $this->errors[$curlInfo['rawurl']] = "REDIRECT TO 404"; 731 | 732 | return true; 733 | } else { 734 | // Some servers don't support NOBODY requests, so if redirect to a 404 page 735 | // is returned, we'll check the URL again with a full page request. 736 | return null; 737 | } 738 | } 739 | // Check if there was a redirect by comparing final URL with original URL 740 | if ( $effectiveUrlClean != $this->cleanURL( $curlInfo['url'] ) ) { 741 | // Check against possible roots 742 | foreach ( $possibleRoots as $root ) { 743 | // We found a match with final url and a possible root url 744 | if ( $root == $effectiveUrlClean ) { 745 | $this->errors[$curlInfo['rawurl']] = "REDIRECT TO ROOT"; 746 | if ( !$httpVersionMismatch && !$full ) return true; 747 | else return null; 748 | } 749 | } 750 | } 751 | // If there was an error during the CURL process, check if the code 752 | // returned is a server side problem 753 | if ( in_array( $curlInfo['curl_error'], $this->curlErrorCodes ) ) { 754 | $this->errors[$curlInfo['rawurl']] = 755 | "Curl Error {$curlInfo['curl_error']}: {$curlInfo['curl_error_msg']}"; 756 | 757 | return true; 758 | } 759 | if ( $httpCode === 0 ) { 760 | if ( $full ) { 761 | $this->errors[$curlInfo['rawurl']] = "NO RESPONSE FROM SERVER"; 762 | $this->errors[$curlInfo['rawurl']] .= " - Curl Error {$curlInfo['curl_error']}: {$curlInfo['curl_error_msg']}"; 763 | $this->errors[$curlInfo['rawurl']] .= " - Failed after {$curlInfo['exec_time']} us"; 764 | if ( $curlInfo['exec_time'] >= 1000 ) { 765 | return true; 766 | } else { 767 | $this->errors[$curlInfo['rawurl']] = "NO RESPONSE FROM SERVER - POTENTIAL FALSE POSITIVE"; 768 | 769 | return null; 770 | } 771 | } else { 772 | // Some servers don't support NOBODY requests, so if redirect to a 404 page 773 | // is returned, we'll check the URL again with a full page request. 774 | return null; 775 | } 776 | } 777 | // Check for valid non-error codes for HTTP or FTP 778 | if ( $requestType != "FTP" && !in_array( $httpCode, $this->goodHttpCodes ) ) { 779 | $this->errors[$curlInfo['rawurl']] = "HTTP RESPONSE CODE: $httpCode"; 780 | if ( !$httpVersionMismatch && !$full ) return true; 781 | else return null; 782 | // Check for valid non-error codes for FTP 783 | } elseif ( $requestType == "FTP" && !in_array( $httpCode, $this->goodFtpCodes ) ) { 784 | $this->errors[$curlInfo['rawurl']] = "FTP RESPONSE CODE: $httpCode"; 785 | if ( !$httpVersionMismatch && !$full ) return true; 786 | else return null; 787 | } 788 | 789 | // Yay, the checks passed, and the site is alive. 790 | return false; 791 | } 792 | 793 | /** 794 | * Compile an array of "possible" root URLs. With subdomain, without subdomain etc. 795 | * 796 | * @param string $url Initial url 797 | * @return array Possible root domains (strings) 798 | */ 799 | protected function getDomainRoots( $url ) { 800 | $roots = []; 801 | $pieces = parse_url( $url ); 802 | if ( !isset( $pieces['host'], $pieces['host'] ) ) { 803 | return []; 804 | } 805 | $roots[] = $pieces['host']; 806 | $roots[] = $pieces['host'] . '/'; 807 | $domain = isset( $pieces['host'] ) ? $pieces['host'] : ''; 808 | if ( preg_match( '/(?P[a-z0-9][a-z0-9\-]{1,63}\.[a-z.]{2,6})$/i', $domain, $regs ) ) { 809 | $roots[] = $regs['domain']; 810 | $roots[] = $regs['domain'] . '/'; 811 | } 812 | $parts = explode( '.', $pieces['host'] ); 813 | if ( count( $parts ) >= 3 ) { 814 | $roots[] = implode( '.', array_slice( $parts, -2 ) ); 815 | $roots[] = implode( '.', array_slice( $parts, -2 ) ) . '/'; 816 | } 817 | 818 | return $roots; 819 | } 820 | 821 | /** 822 | * Properly encode the URL to ensure the receiving webservice understands the request. 823 | * 824 | * @param string $url URL to sanitize 825 | * @param bool $stripFragment Remove the fragment from the URL. 826 | * @param bool $preserveQueryEncoding Preserve the whitespace encoding of query strings. 827 | * @return string sanitized URL 828 | */ 829 | public function sanitizeURL( $url, $stripFragment = false, $preserveQueryEncoding = false ) { 830 | // The domain is easily decoded by the DNS handler, 831 | // but the path is what's seen by the respective webservice. 832 | // We need to encode it as some 833 | // can't handle decoded characters. 834 | // Break up the URL first 835 | $parts = $this->parseURL( $url ); 836 | // Some rare URLs don't like it when %20 is passed in the query and require the +. 837 | // %20 is the most common usage to represent a whitespace in the query. 838 | // So convert them to unique values that will survive the encoding/decoding process. 839 | if ( $parts === false ) return false; 840 | if ( $preserveQueryEncoding === true && isset( $parts['query'] ) ) { 841 | $parts['query'] = str_replace( "%20", "CHECKIFDEADHEXSPACE", $parts['query'] ); 842 | } 843 | // In case the protocol is missing, assume it goes to HTTPS 844 | if ( !isset( $parts['scheme'] ) ) { 845 | $url = "https"; 846 | } else { 847 | $url = strtolower( $parts['scheme'] ); 848 | } 849 | // Move on to the domain 850 | $url .= "://"; 851 | // Add username and password if present 852 | if ( isset( $parts['user'] ) ) { 853 | $url .= $parts['user']; 854 | if ( isset( $parts['pass'] ) ) { 855 | $url .= ":" . $parts['pass']; 856 | } 857 | $url .= "@"; 858 | } 859 | // Add host 860 | if ( isset( $parts['host'] ) ) { 861 | // Properly encode the host. It can't be UTF-8. 862 | // See https://en.wikipedia.org/wiki/Internationalized_domain_name. 863 | if ( function_exists( 'idn_to_ascii' ) ) { 864 | $url .= strtolower( idn_to_ascii( $parts['host'], IDNA_DEFAULT, INTL_IDNA_VARIANT_UTS46 ) ); 865 | } else { 866 | $url .= strtolower( $parts['host'] ); 867 | } 868 | if ( isset( $parts['port'] ) ) { 869 | // Ports are only needed if not using the defaults for the scheme. 870 | // Remove port numbers if they are the default. 871 | switch ( $parts['port'] ) { 872 | case 80: 873 | if ( isset( $parts['scheme'] ) && 874 | strtolower( $parts['scheme'] ) == "http" 875 | ) { 876 | break; 877 | } 878 | case 443: 879 | if ( !isset( $parts['scheme'] ) || 880 | strtolower( $parts['scheme'] ) == "https" 881 | ) { 882 | break; 883 | } 884 | case 21: 885 | if ( isset( $parts['scheme'] ) && 886 | strtolower( $parts['scheme'] ) == "ftp" 887 | ) { 888 | break; 889 | } 890 | case 554: 891 | if ( isset( $parts['scheme'] ) && 892 | strtolower( $parts['scheme'] ) == "rtsp" 893 | ) { 894 | break; 895 | } 896 | default: 897 | $url .= ":" . $parts['port']; 898 | } 899 | } 900 | } 901 | // Make sure path, query, and fragment are properly encoded, and not over-encoded. 902 | // This avoids possible 400 Bad Response errors. 903 | $url .= "/"; 904 | if ( isset( $parts['path'] ) && strlen( $parts['path'] ) > 1 ) { 905 | // There are legal characters that do not need encoding in the path 906 | // and some webservers cannot handle these being encoded 907 | // If we only have legal characters, we can skip sanitizing the path 908 | $legalRegex = '/[^0-9a-zA-Z$\-\_\.\+\!\*\(\)\,\~\:\/\[\]\@\;\=\%]/'; 909 | if ( preg_match( $legalRegex, $parts['path'] ) ) { 910 | // Pluses in the path are legal characters that do not need to be encoded. 911 | // Some URLs don't like the plus encoded. 912 | $parts['path'] = str_replace( "+", "CHECKIFDEADPLUSSPACE", $parts['path'] ); 913 | $url .= implode( '/', 914 | array_map( "rawurlencode", 915 | explode( '/', 916 | substr( 917 | rawurldecode( $parts['path'] ), 1 918 | ) 919 | ) 920 | ) 921 | ); 922 | } else { 923 | $url .= substr( $parts['path'], 1 ); 924 | } 925 | } 926 | if ( isset( $parts['query'] ) ) { 927 | $url .= "?"; 928 | // There are legal characters that do not need encoding in the query 929 | // and some webservers cannot handle these being encoded 930 | // If we only have legal characters, we can skip sanitizing the query 931 | $legalRegex = '/[^0-9a-zA-Z$\-\_\.\+\!\*\(\)\,\~\:\[\]\@\;\&\=\%\/]/'; 932 | if ( preg_match( $legalRegex, $parts['query'] ) ) { 933 | // Encoding the + means a literal plus in the query. 934 | // A plus means a space otherwise. 935 | $parts['query'] = str_replace( "+", "CHECKIFDEADPLUSSPACE", $parts['query'] ); 936 | // We have a query string, all queries start with a ? 937 | // Break apart the query string. Separate them into all of the arguments passed. 938 | $parts['query'] = preg_split('/[&;]/', $parts['query']); 939 | // We need to encode each argument 940 | foreach ( $parts['query'] as $index => $argument ) { 941 | // Make sure we don't inadvertently encode the first instance of "=" 942 | // Otherwise we break the query. 943 | $parts['query'][$index] = implode( '=', 944 | array_map( "rawurlencode", 945 | array_map( "urldecode", 946 | explode( '=', $parts['query'][$index], 2 ) 947 | ) 948 | ) 949 | ); 950 | } 951 | // Put the query string back together. 952 | $parts['query'] = implode( '&', $parts['query'] ); 953 | $url .= $parts['query']; 954 | } else { 955 | $url .= $parts['query']; 956 | } 957 | } 958 | if ( $stripFragment === false && isset( $parts['fragment'] ) ) { 959 | // We don't need to encode the fragment, that's handled client side anyways. 960 | $url .= "#" . $parts['fragment']; 961 | } 962 | $url = str_replace( "CHECKIFDEADPLUSSPACE", "+", $url ); 963 | // Convert our identifiers back into URL elements. 964 | if ( $preserveQueryEncoding === true ) { 965 | $url = str_replace( "CHECKIFDEADHEXSPACE", "%20", $url ); 966 | } 967 | 968 | return $url; 969 | } 970 | 971 | /** 972 | * Custom parse_url function to support UTF-8 URLs 973 | * 974 | * @param string $url The URL to parse 975 | * @return mixed False on failure, array on success. For example: 976 | * array( 'scheme' => 'https', 'host' => 'hello.com', 'path' => '/en/' ) ) 977 | */ 978 | public function parseURL( $url ) { 979 | // Feeding fully encoded URLs will not work. So let's detect and decode if needed first. 980 | // This is just idiot proofing. 981 | // See if the URL is fully encoded by checking if the :// is encoded. 982 | // This prevents URLs where double encoded values aren't mistakenly decoded breaking the URL. 983 | if ( preg_match( '/^([a-z0-9+\-.]*)(?:%3A%2F%2F|%3A\/\/|:%2F%2F)/i', $url ) ) { 984 | // First let's break the fragment out to prevent accidentally mistaking a decoded %23 as a # 985 | $fragment = parse_url( $url, PHP_URL_FRAGMENT ); 986 | if ( !is_null( $fragment ) ) { 987 | $url = strstr( $url, "#", true ); 988 | } 989 | // Decode URL 990 | $url = rawurldecode( $url ); 991 | // Re-encode the remaining #'s 992 | $url = str_replace( "#", "%23", $url ); 993 | // Reattach the fragment 994 | if ( !is_null( $fragment ) ) { 995 | $url .= "#$fragment"; 996 | } 997 | } 998 | // Sometimes the scheme is followed by a single slash instead of a double. 999 | // Web browsers and archives support this, so we should too. 1000 | if ( preg_match( '/^([a-z0-9+\-.]*:)?\/([^\/].+)/i', $url, $match ) ) { 1001 | $url = $match[1] . "//" . $match[2]; 1002 | } 1003 | // Sometimes protocol relative URLs are not formatted correctly 1004 | // This checks to see if the URL starts with :/ or :// 1005 | // We will assume http in these cases 1006 | if ( preg_match( '/^:\/\/?([^\/].+)/i', $url, $match ) ) { 1007 | $url = "http://" . $match[1]; 1008 | } 1009 | // If we're missing the scheme and double slashes entirely, assume http. 1010 | // The parse_url function fails without this 1011 | if ( !preg_match( '/(?:[a-z0-9+\-.]*:)?\/\//i', $url ) ) { 1012 | $url = "http://" . $url; 1013 | } 1014 | $encodedUrl = preg_replace_callback( 1015 | '%[^:/@?&=#;]+%sD', 1016 | function ( $matches ) { 1017 | return urlencode( $matches[0] ); 1018 | }, 1019 | $url 1020 | ); 1021 | $parts = parse_url( $encodedUrl ); 1022 | // Check if the URL was actually parsed. 1023 | if ( $parts !== false ) { 1024 | foreach ( $parts as $name => $value ) { 1025 | $parts[$name] = urldecode( $value ); 1026 | } 1027 | } 1028 | 1029 | return $parts; 1030 | } 1031 | 1032 | /** 1033 | * Remove scheme, 'www', URL fragment, leading forward slashes and trailing slash 1034 | * 1035 | * @param string $input 1036 | * @return string Cleaned url string 1037 | */ 1038 | public function cleanURL( $input ) { 1039 | // scheme and www 1040 | $url = preg_replace( '/^((https?:|ftp:)?(\/\/))?(www\.)?/', '', $input ); 1041 | // fragment 1042 | $url = preg_replace( '/#.*/', '', $url ); 1043 | // trailing slash 1044 | $url = preg_replace( '{/$}', '', $url ); 1045 | 1046 | return $url; 1047 | } 1048 | 1049 | /** 1050 | * Returns the errors encountered on URLs that resulted in a dead response 1051 | * 1052 | * @return array All the errors indexed by URL. 1053 | */ 1054 | public function getErrors() { 1055 | return $this->errors; 1056 | } 1057 | 1058 | /** 1059 | * Returns all of the data collected during the curl request. 1060 | * 1061 | * @return array All curl statistics gathered during the request. 1062 | */ 1063 | public function getRequestDetails() { 1064 | return $this->details; 1065 | } 1066 | 1067 | /** 1068 | * Returns all of the snapshots collected during the curl request. 1069 | * 1070 | * @return array All page snapshots gathered during the request. 1071 | */ 1072 | public function getRequestSnapshots() { 1073 | return $this->snapshots; 1074 | } 1075 | 1076 | /** 1077 | * Returns the status of TOR readiness 1078 | * 1079 | * @return bool False if the environment doesn't support TOR 1080 | */ 1081 | public static function isTorEnabled() { 1082 | return self::$torEnabled; 1083 | } 1084 | } 1085 | --------------------------------------------------------------------------------