Gitpedia
thecodingmachine

thecodingmachine/safe

All PHP functions, rewritten to throw exceptions instead of returning false

30 Releases
Latest: 3mo ago
v3.4.0Latest
shishshish·3mo ago·February 15, 2026
GitHub

📋 What's Changed

  • Don't include descriptions in the generated DocBlocks by @JakeQZ in https://github.com/thecodingmachine/safe/pull/707
  • Deduplicate generated files by @shish in https://github.com/thecodingmachine/safe/pull/719
  • Support for php 8.6 by @shish in https://github.com/thecodingmachine/safe/pull/717
  • fix: `passthru` on PHP 8.1 by @silasjoisten in https://github.com/thecodingmachine/safe/pull/691
  • Add missing `hash_file()` and `hash_hmac_file()` functions by @cedric-anne in https://github.com/thecodingmachine/safe/pull/694
  • feat(chore): Adds `download-docs` command by @silasjoisten in https://github.com/thecodingmachine/safe/pull/697
  • feat(PHP 8.1): support for `ftp_raw` by @silasjoisten in https://github.com/thecodingmachine/safe/pull/693
  • feat(chore): normalize `composer.json` by @silasjoisten in https://github.com/thecodingmachine/safe/pull/698
  • + 9 more

New Contributors

  • @silasjoisten made their first contribution in https://github.com/thecodingmachine/safe/pull/691
  • @JakeQZ made their first contribution in https://github.com/thecodingmachine/safe/pull/708
  • @oliverklee made their first contribution in https://github.com/thecodingmachine/safe/pull/718
  • @rafaelcx made their first contribution in https://github.com/thecodingmachine/safe/pull/720
  • Full Changelog: https://github.com/thecodingmachine/safe/compare/v3.3.0...v3.4.0
v3.3.0
OskarStarkOskarStark·1y ago·May 14, 2025
GitHub

📋 What's Changed

  • Fix `mktime()` on PHP 8.2 and 8.3 by @cedric-anne in https://github.com/thecodingmachine/safe/pull/670
  • Ignore `long2ip()` that is actually safe by @cedric-anne in https://github.com/thecodingmachine/safe/pull/671
  • Fix `array_combine()` on PHP 8.1 by @cedric-anne in https://github.com/thecodingmachine/safe/pull/672
  • Fix `array_flip()` on PHP 8.1 by @cedric-anne in https://github.com/thecodingmachine/safe/pull/673
  • Fix `array_replace()` / `array_replace_recursive()` on PHP 8.1 by @cedric-anne in https://github.com/thecodingmachine/safe/pull/674
  • Fix `gmp_random_seed()` on PHP 8.1 by @cedric-anne in https://github.com/thecodingmachine/safe/pull/677
  • Fix `hash_hkdf()` on PHP 8.1 by @cedric-anne in https://github.com/thecodingmachine/safe/pull/678
  • Fix `sleep()` on PHP 8.1 by @cedric-anne in https://github.com/thecodingmachine/safe/pull/679
  • + 11 more
v3.2.0
silasjoistensilasjoisten·1y ago·May 13, 2025
GitHub

📋 What's Changed

  • fix typehint for ini_set, see #133 by @shish in https://github.com/thecodingmachine/safe/pull/661
  • detect openssl_pkey_get_details in earlier php versions, see #662 by @shish in https://github.com/thecodingmachine/safe/pull/663
  • Hide the already safe `pack()` function by @cedric-anne in https://github.com/thecodingmachine/safe/pull/664
  • Fix the generation of `gmmktime()`/`mktime()` on PHP 8.4+ by @cedric-anne in https://github.com/thecodingmachine/safe/pull/667
  • Ignore the already safe `array_walk_recursive()` function by @cedric-anne in https://github.com/thecodingmachine/safe/pull/666
  • Ignore the already safe `getallheaders()` function by @cedric-anne in https://github.com/thecodingmachine/safe/pull/668
  • Ignore the already safe `imagesx()`/`imagesy()` functions by @cedric-anne in https://github.com/thecodingmachine/safe/pull/669
  • Ignore the already safe `date()` function by @cedric-anne in https://github.com/thecodingmachine/safe/pull/665

New Contributors

  • @cedric-anne made their first contribution in https://github.com/thecodingmachine/safe/pull/664
  • Full Changelog: https://github.com/thecodingmachine/safe/compare/v3.1.1...v3.2.0
v3.1.1
silasjoistensilasjoisten·1y ago·April 28, 2025
GitHub

📋 What's Changed

  • Automatically regenerate the files by @github-actions in https://github.com/thecodingmachine/safe/pull/652
  • Automatically regenerate the files by @github-actions in https://github.com/thecodingmachine/safe/pull/655
  • Automatically regenerate the files by @github-actions in https://github.com/thecodingmachine/safe/pull/656
  • `openssl_random_pseudo_bytes` always returns string (closes #654) by @mvhirsch in https://github.com/thecodingmachine/safe/pull/658

New Contributors

  • @mvhirsch made their first contribution in https://github.com/thecodingmachine/safe/pull/658
  • Full Changelog: https://github.com/thecodingmachine/safe/compare/v3.1.0...v3.1.1
v3.1.0
silasjoistensilasjoisten·1y ago·April 15, 2025
GitHub

📋 What's Changed

  • Automatically regenerate the files by @github-actions in https://github.com/thecodingmachine/safe/pull/639
  • Automatically regenerate the files by @github-actions in https://github.com/thecodingmachine/safe/pull/641
  • Add falsy regexes, primarily for session functions by @timsmid in https://github.com/thecodingmachine/safe/pull/642
  • Mark sodium verify functions as hidden by @timsmid in https://github.com/thecodingmachine/safe/pull/643
  • Automatically regenerate the files by @github-actions in https://github.com/thecodingmachine/safe/pull/644
  • [generator] use libxml internal errors by @shish in https://github.com/thecodingmachine/safe/pull/648
  • [array_combine] override phpstan's incorrect function map, fixes #646 by @shish in https://github.com/thecodingmachine/safe/pull/647
  • [json_decode] update function signature to match PHP 8.X, fixes #645 by @shish in https://github.com/thecodingmachine/safe/pull/649
  • + 2 more

New Contributors

  • @timsmid made their first contribution in https://github.com/thecodingmachine/safe/pull/642
  • Full Changelog: https://github.com/thecodingmachine/safe/compare/v3.0.2...v3.0.3
v3.0.2
shishshish·1y ago·February 19, 2025
GitHub

📋 What's Changed

  • Be consistent in using more-specific types in docblocks by @shish in https://github.com/thecodingmachine/safe/pull/635
  • Remove more redundant overrides by @shish in https://github.com/thecodingmachine/safe/pull/636
  • more docs by @shish in https://github.com/thecodingmachine/safe/pull/634
  • Full Changelog: https://github.com/thecodingmachine/safe/compare/v3.0.1...v3.0.2
v3.0.1
shishshish·1y ago·February 18, 2025
GitHub

📋 What's Changed (Externally visible)

  • Generate full functions even for pass-through wrappers, fixes #621 by @shish in https://github.com/thecodingmachine/safe/pull/622
  • Add a hidden functions list, fixes #618 by @shish in https://github.com/thecodingmachine/safe/pull/631
  • More thorough nullability detection by @shish in https://github.com/thecodingmachine/safe/pull/626
  • Make _all_ return types alphabetical by @shish in https://github.com/thecodingmachine/safe/pull/624

📋 What's Changed (Internals)

  • Fix typos by @szepeviktor in https://github.com/thecodingmachine/safe/pull/616
  • Update .gitattributes by @mfn in https://github.com/thecodingmachine/safe/pull/620
  • [generator] better error handling by @shish in https://github.com/thecodingmachine/safe/pull/623
  • [generator] remove unused function by @shish in https://github.com/thecodingmachine/safe/pull/625
  • [generator] remove some redundant edge-cases by @shish in https://github.com/thecodingmachine/safe/pull/628
  • Hide a couple of parameters from stack traces by @shish in https://github.com/thecodingmachine/safe/pull/629
  • [generator] defer nullable/falsable handling by @shish in https://github.com/thecodingmachine/safe/pull/630
  • Remove another redundant "bugfix" (and in doing so, fix `pg_copy_from`) by @shish in https://github.com/thecodingmachine/safe/pull/632
  • + 1 more

New Contributors

  • @mfn made their first contribution in https://github.com/thecodingmachine/safe/pull/620
  • Full Changelog: https://github.com/thecodingmachine/safe/compare/v3.0.0...v3.0.1
v3.0.0
shishshish·1y ago·February 11, 2025
GitHub

📋 What's Changed (tl;dr)

  • Compatibility with PHP 8.4 - no more syntax deprecation warnings
  • Dropped support for EOL'ed PHP versions - PHP 8.1 is the new minimum
  • Separate wrappers generated for each PHP version, to make sure that the wrappers match the standard library whether you're using 8.1 or 8.4
  • Lots more unsafe functions are detected (including those which return `-1` on error)
  • Type hints should be more expansive and more accurate
  • Internals cleaned up and documentation added, to make the project easier to contribute to

📋 What's Changed (Full)

  • Change misspelled occured to occurred by @spawnia in https://github.com/thecodingmachine/safe/pull/416
  • Remove dev-master aliases by @shish in https://github.com/thecodingmachine/safe/pull/463
  • Add dependabot config by @shish in https://github.com/thecodingmachine/safe/pull/459
  • Add devcontainer config by @shish in https://github.com/thecodingmachine/safe/pull/458
  • Update CI/CD workflows by @shish in https://github.com/thecodingmachine/safe/pull/460
  • Bring lib/ up to php8.4 standards by @shish in https://github.com/thecodingmachine/safe/pull/466
  • Bring deprecated override files up to php8.4 syntax by @shish in https://github.com/thecodingmachine/safe/pull/464
  • Add auto-regenerate CI workflow by @shish in https://github.com/thecodingmachine/safe/pull/461
  • + 128 more

New Contributors

  • @spawnia made their first contribution in https://github.com/thecodingmachine/safe/pull/416
  • @shish made their first contribution in https://github.com/thecodingmachine/safe/pull/463
  • @marmichalski made their first contribution in https://github.com/thecodingmachine/safe/pull/451
  • @staabm made their first contribution in https://github.com/thecodingmachine/safe/pull/469
  • @WyriHaximus made their first contribution in https://github.com/thecodingmachine/safe/pull/445
  • @smoench made their first contribution in https://github.com/thecodingmachine/safe/pull/506
  • @tacman made their first contribution in https://github.com/thecodingmachine/safe/pull/514
  • Full Changelog: https://github.com/thecodingmachine/safe/compare/v2.5.0...v3.0.0
v2.5.0
KharhamelKharhamel·3y ago·April 9, 2023
GitHub

📋 What's Changed

  • Automatically regenerate the files by @github-actions in https://github.com/thecodingmachine/safe/pull/397
  • Fix DateTimeImmutable::createFromInterface error by @yann-eugone in https://github.com/thecodingmachine/safe/pull/402
  • specify Safe\createFromMutable return changing type for php8.2 by @MarvinCourcier in https://github.com/thecodingmachine/safe/pull/406
  • FIX: Fix openssl_pkey_get_* functions by @martinssipenko in https://github.com/thecodingmachine/safe/pull/409

New Contributors

  • @yann-eugone made their first contribution in https://github.com/thecodingmachine/safe/pull/402
  • @MarvinCourcier made their first contribution in https://github.com/thecodingmachine/safe/pull/406
  • @martinssipenko made their first contribution in https://github.com/thecodingmachine/safe/pull/409
  • Full Changelog: https://github.com/thecodingmachine/safe/compare/v2.4.0...v2.5.0
v2.4.0
KharhamelKharhamel·3y ago·October 7, 2022
GitHub

📋 What's Changed

  • Automatically regenerate the files by @github-actions in https://github.com/thecodingmachine/safe/pull/394
  • stream_filter_append & stream_filter_prepend use mixed instead of array by @ildyria in https://github.com/thecodingmachine/safe/pull/395

New Contributors

  • @ildyria made their first contribution in https://github.com/thecodingmachine/safe/pull/395
  • Full Changelog: https://github.com/thecodingmachine/safe/compare/v2.3.1...v2.4.0
v2.3.1
KharhamelKharhamel·3y ago·September 20, 2022
GitHub

📋 What's Changed

  • Automatically regenerate the files by @github-actions in https://github.com/thecodingmachine/safe/pull/391
  • Automatically regenerate the files by @github-actions in https://github.com/thecodingmachine/safe/pull/393
  • Fix undefined sleep() function due to autoloading issue by @colinodell in https://github.com/thecodingmachine/safe/pull/390

New Contributors

  • @colinodell made their first contribution in https://github.com/thecodingmachine/safe/pull/390
  • Full Changelog: https://github.com/thecodingmachine/safe/compare/v2.3.0...v2.3.1
v2.3.0
KharhamelKharhamel·3y ago·September 13, 2022
GitHub

📋 What's Changed

  • Link to step 1 rather then svn update by @alexandreelise in https://github.com/thecodingmachine/safe/pull/378
  • Update rector-migrate.php to support latest Rector by @alexandreelise in https://github.com/thecodingmachine/safe/pull/372
  • Use specific result variable name by @szepeviktor in https://github.com/thecodingmachine/safe/pull/377
  • Automatically regenerate the files by @github-actions in https://github.com/thecodingmachine/safe/pull/379
  • Update README.md by @msng in https://github.com/thecodingmachine/safe/pull/383
  • deprecated mktime and regenerated the files by @Kharhamel in https://github.com/thecodingmachine/safe/pull/385
  • WIP: FIX: changed openssl functions typehinting from ressource to OpenSSLCertificate by @Kharhamel in https://github.com/thecodingmachine/safe/pull/381
  • deprecated sleep() by @Kharhamel in https://github.com/thecodingmachine/safe/pull/387
  • + 1 more

New Contributors

  • @alexandreelise made their first contribution in https://github.com/thecodingmachine/safe/pull/378
  • @msng made their first contribution in https://github.com/thecodingmachine/safe/pull/383
  • Full Changelog: https://github.com/thecodingmachine/safe/compare/v2.2.3...v2.3.0
v2.2.3
dbrekelmansdbrekelmans·3y ago·August 4, 2022
GitHub

📋 What's Changed

  • Bump guzzlehttp/guzzle from 7.4.3 to 7.4.5 in /generator by @dependabot in https://github.com/thecodingmachine/safe/pull/367
  • Update .gitattributes to `export-ignore` additional files by @TimWolla in https://github.com/thecodingmachine/safe/pull/371
  • Automatically regenerate the files by @github-actions in https://github.com/thecodingmachine/safe/pull/373
  • issue 324: change parameter name from options to flags by @MarcinGladkowski in https://github.com/thecodingmachine/safe/pull/376
  • Automatically regenerate the files by @github-actions in https://github.com/thecodingmachine/safe/pull/374

New Contributors

  • @TimWolla made their first contribution in https://github.com/thecodingmachine/safe/pull/371
  • @MarcinGladkowski made their first contribution in https://github.com/thecodingmachine/safe/pull/376
  • Full Changelog: https://github.com/thecodingmachine/safe/compare/v2.2.2...v2.2.3
v2.2.2
KharhamelKharhamel·3y ago·July 20, 2022
GitHub

📋 What's Changed

  • Automatically regenerate the files by @github-actions in https://github.com/thecodingmachine/safe/pull/364
  • FIX: Deprecated array_replace and array_replace_recursive by @Kharhamel in https://github.com/thecodingmachine/safe/pull/369
  • Fixed an error with the CurlException by @Kharhamel in https://github.com/thecodingmachine/safe/pull/370
  • Full Changelog: https://github.com/thecodingmachine/safe/compare/v2.2.1...v2.2.2
v2.2.1
KharhamelKharhamel·3y ago·June 9, 2022
GitHub

📋 What's Changed

  • FIX: regenerated the files without losing support for date by @Kharhamel in https://github.com/thecodingmachine/safe/pull/362
  • Bump guzzlehttp/guzzle from 7.4.2 to 7.4.3 in /generator by @dependabot in https://github.com/thecodingmachine/safe/pull/359

New Contributors

  • @dependabot made their first contribution in https://github.com/thecodingmachine/safe/pull/359
  • Full Changelog: https://github.com/thecodingmachine/safe/compare/v2.2.0...v2.2.1
v2.2.0
KharhamelKharhamel·4y ago·May 25, 2022
GitHub

📋 What's Changed

  • Replace PSR-4 with classmap autoloader by @j3j5 in https://github.com/thecodingmachine/safe/pull/350
  • Automatically regenerate the files by @github-actions in https://github.com/thecodingmachine/safe/pull/354
  • Updating the dev-master alias by @moufmouf in https://github.com/thecodingmachine/safe/pull/347
  • Automatically regenerate the files by @github-actions in https://github.com/thecodingmachine/safe/pull/355
  • Automatically regenerate the files by @github-actions in https://github.com/thecodingmachine/safe/pull/358
  • Make Safe\Exceptions\JsonException inherits from \JsonException by @jdecool in https://github.com/thecodingmachine/safe/pull/357

New Contributors

  • @jdecool made their first contribution in https://github.com/thecodingmachine/safe/pull/357
  • Full Changelog: https://github.com/thecodingmachine/safe/compare/v2.1.4...v2.2.0
v2.2-alphaPre-release
KharhamelKharhamel·4y ago·May 9, 2022
GitHub

This is an alpha to test @j3j5 new autoloading structure to try to fix #235 once and for all. This shouldn't break anything but better safe than sorry

v2.1.4
KharhamelKharhamel·4y ago·May 2, 2022
GitHub

📋 What's Changed

  • Automatically regenerate the files by @github-actions in https://github.com/thecodingmachine/safe/pull/339
  • Automatically regenerate the files by @github-actions in https://github.com/thecodingmachine/safe/pull/340
  • Automatically regenerate the files by @github-actions in https://github.com/thecodingmachine/safe/pull/341
  • FEATURE: array_combine is now deprecated by @Kharhamel in https://github.com/thecodingmachine/safe/pull/346
  • Automatically regenerate the files by @github-actions in https://github.com/thecodingmachine/safe/pull/342
  • Fix CS in rector-migrate.php by @szepeviktor in https://github.com/thecodingmachine/safe/pull/349
  • FEATURE: added back imagecreatefromstring by @Kharhamel in https://github.com/thecodingmachine/safe/pull/353

New Contributors

  • @j3j5 made their first contribution in https://github.com/thecodingmachine/safe/pull/333
  • Full Changelog: https://github.com/thecodingmachine/safe/compare/v2.1.3...v2.1.4
v2.1.3
KharhamelKharhamel·4y ago·March 30, 2022
GitHub

📋 What's Changed

  • Automatically regenerate the files by @github-actions in https://github.com/thecodingmachine/safe/pull/326
  • Automatically regenerate the files by @github-actions in https://github.com/thecodingmachine/safe/pull/329
  • Automatically regenerate the files by @github-actions in https://github.com/thecodingmachine/safe/pull/330
  • Phpstan/update by @Kharhamel in https://github.com/thecodingmachine/safe/pull/335
  • FIX: the generator now ignore the number typehints from phpstan by @Kharhamel in https://github.com/thecodingmachine/safe/pull/336
  • Full Changelog: https://github.com/thecodingmachine/safe/compare/v2.1.2...v2.1.3
v2.1.2
dbrekelmansdbrekelmans·4y ago·February 1, 2022
GitHub

📋 What's Changed

  • bring in curl handles by @mmoll in https://github.com/thecodingmachine/safe/pull/322

New Contributors

  • @mmoll made their first contribution in https://github.com/thecodingmachine/safe/pull/322
  • Full Changelog: https://github.com/thecodingmachine/safe/compare/v2.1.1...v2.1.2
v2.1.1
dbrekelmansdbrekelmans·4y ago·January 25, 2022
GitHub

📋 What's Changed

  • Fixed return type of DateTimeImmutable by @nusje2000 in https://github.com/thecodingmachine/safe/pull/323
  • Full Changelog: https://github.com/thecodingmachine/safe/compare/v2.1.0...v2.1.1
v2.1.0
KharhamelKharhamel·4y ago·January 18, 2022
GitHub

📋 What's Changed

  • Automatically regenerate the files by @github-actions in https://github.com/thecodingmachine/safe/pull/321
  • Adding back some removed functions for PHP 8 (adding as deprecated) by @jaydiablo in https://github.com/thecodingmachine/safe/pull/320

New Contributors

  • @jaydiablo made their first contribution in https://github.com/thecodingmachine/safe/pull/320
  • Full Changelog: https://github.com/thecodingmachine/safe/compare/v2.0.2...v2.1.0
v2.0.2
KharhamelKharhamel·4y ago·January 11, 2022
GitHub

📋 What's Changed

  • Fix fputcsv annotation by @Jean85 in https://github.com/thecodingmachine/safe/pull/318
  • Full Changelog: https://github.com/thecodingmachine/safe/compare/v2.0.1...v2.0.2
v2.0.1
KharhamelKharhamel·4y ago·January 11, 2022
GitHub

📋 What's Changed

  • Automatically regenerate the files by @github-actions in https://github.com/thecodingmachine/safe/pull/311
  • Curl init by @Kharhamel in https://github.com/thecodingmachine/safe/pull/315
  • FEATURE: move the file CustomPhpStanFunctionMap to the config directory and improved the cache CI by @Kharhamel in https://github.com/thecodingmachine/safe/pull/319
  • Full Changelog: https://github.com/thecodingmachine/safe/compare/2.0...v2.0.1
2.0
dbrekelmansdbrekelmans·4y ago·January 3, 2022
GitHub

This release finally brings PHP8 support! 🎉🎉🎉 If you find any issues, please report them and feel free to contribute your own PRs as well!

2.0.0-alpha.3Pre-release
dbrekelmansdbrekelmans·4y ago·October 17, 2021
GitHub

📋 What's Changed

  • Empty strings functions by @Kharhamel in https://github.com/thecodingmachine/safe/pull/303
  • Improved scanner to only look at the "returnvalues" sections by @Duroth in https://github.com/thecodingmachine/safe/pull/305
  • Full Changelog: https://github.com/thecodingmachine/safe/compare/2.0.0-alpha.2...2.0.0-alpha.3
2.0.0-alpha.2Pre-release
dbrekelmansdbrekelmans·4y ago·October 16, 2021
GitHub

📋 What's Changed

  • Prevent generic syntax from messing up php native types by @dbrekelmans in https://github.com/thecodingmachine/safe/pull/290
  • FIX: updated the regexp to detect class_implements by @Kharhamel in https://github.com/thecodingmachine/safe/pull/296
  • FIX: updated the generator phpstan to 0.12.99 by @Kharhamel in https://github.com/thecodingmachine/safe/pull/299
  • Fix createFromMutable error by @dbrekelmans in https://github.com/thecodingmachine/safe/pull/298
  • Fixed else statement code style by @nusje2000 in https://github.com/thecodingmachine/safe/pull/297
  • Fixed function definition from containing unnecessary spaces by @nusje2000 in https://github.com/thecodingmachine/safe/pull/300
  • Fix whitespace by @dbrekelmans in https://github.com/thecodingmachine/safe/pull/301
  • generate imagegrabwindow by @dbrekelmans in https://github.com/thecodingmachine/safe/pull/302

New Contributors

  • @nusje2000 made their first contribution in https://github.com/thecodingmachine/safe/pull/297

📦 Special thanks

  • Special thanks to @Duroth for checking which generated files require fixes
  • Full Changelog: https://github.com/thecodingmachine/safe/compare/2.0.0-alpha.1...2.0.0-alpha.2
2.0.0-alpha.1Pre-release
dbrekelmansdbrekelmans·4y ago·October 1, 2021
GitHub

This release adds support for PHP8 and drops support for PHP7.x and lower. Give it a try and let us know through github issues if you encounter any problems!

v1.3.3
KharhamelKharhamel·5y ago·October 28, 2020
GitHub

📋 Changes

  • Fixed a bug with socket_write
  • Updated the readme
v1.3.2
KharhamelKharhamel·5y ago·October 22, 2020
GitHub

📋 Changes

  • added the date and gmdate functions ( #246 )
  • imap_fetchstructure, imap_mail_compose and imap_sort were automatically added because of the updated documentation.