{"id":14220138,"url":"https://github.com/laravel/serializable-closure","last_synced_at":"2025-05-13T19:10:18.640Z","repository":{"id":37397722,"uuid":"404020923","full_name":"laravel/serializable-closure","owner":"laravel","description":"Laravel Serializable Closure provides an easy and secure way to serialize closures in PHP.","archived":false,"fork":false,"pushed_at":"2025-03-28T16:31:41.000Z","size":248,"stargazers_count":560,"open_issues_count":5,"forks_count":36,"subscribers_count":18,"default_branch":"2.x","last_synced_at":"2025-05-08T04:18:15.897Z","etag":null,"topics":["closure","php","serialize"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/laravel.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":".github/CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":".github/CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":".github/SECURITY.md","support":".github/SUPPORT.md","governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2021-09-07T15:01:16.000Z","updated_at":"2025-05-01T19:48:43.000Z","dependencies_parsed_at":"2025-04-11T13:37:56.739Z","dependency_job_id":"a651d656-04a7-4d60-aeb1-9fd1f4038b1b","html_url":"https://github.com/laravel/serializable-closure","commit_stats":{"total_commits":145,"total_committers":14,"mean_commits":"10.357142857142858","dds":0.496551724137931,"last_synced_commit":"5c1e047e38fee0cb8fbbe1ed4439ebfd96f64986"},"previous_names":[],"tags_count":24,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/laravel%2Fserializable-closure","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/laravel%2Fserializable-closure/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/laravel%2Fserializable-closure/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/laravel%2Fserializable-closure/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/laravel","download_url":"https://codeload.github.com/laravel/serializable-closure/tar.gz/refs/heads/2.x","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254010823,"owners_count":21998993,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["closure","php","serialize"],"created_at":"2024-08-19T15:01:33.884Z","updated_at":"2025-05-13T19:10:18.521Z","avatar_url":"https://github.com/laravel.png","language":"PHP","funding_links":[],"categories":["Table of Contents"],"sub_categories":["Miscellaneous","Library"],"readme":"# Serializable Closure\n\n\u003ca href=\"https://github.com/laravel/serializable-closure/actions\"\u003e\n    \u003cimg src=\"https://github.com/laravel/serializable-closure/workflows/tests/badge.svg\" alt=\"Build Status\"\u003e\n\u003c/a\u003e\n\u003ca href=\"https://packagist.org/packages/laravel/serializable-closure\"\u003e\n    \u003cimg src=\"https://img.shields.io/packagist/dt/laravel/serializable-closure\" alt=\"Total Downloads\"\u003e\n\u003c/a\u003e\n\u003ca href=\"https://packagist.org/packages/laravel/serializable-closure\"\u003e\n    \u003cimg src=\"https://img.shields.io/packagist/v/laravel/serializable-closure\" alt=\"Latest Stable Version\"\u003e\n\u003c/a\u003e\n\u003ca href=\"https://packagist.org/packages/laravel/serializable-closure\"\u003e\n    \u003cimg src=\"https://img.shields.io/packagist/l/laravel/serializable-closure\" alt=\"License\"\u003e\n\u003c/a\u003e\n\n## Introduction\n\n\u003e This project is a fork of the excellent [opis/closure: 3.x](https://github.com/opis/closure) package. At Laravel, we decided to fork this package as the upcoming version [4.x](https://github.com/opis/closure) is a complete rewrite on top of the [FFI extension](https://www.php.net/manual/en/book.ffi.php). As Laravel is a web framework, and FFI is not enabled by default in web requests, this fork allows us to keep using the `3.x` series while adding support for new PHP versions.\n\nLaravel Serializable Closure provides an easy and secure way to **serialize closures in PHP**.\n\n## Official Documentation\n\n### Installation\n\n\u003e **Requires [PHP 7.4+](https://php.net/releases/)**\n\nFirst, install Laravel Serializable Closure via the [Composer](https://getcomposer.org/) package manager:\n\n```bash\ncomposer require laravel/serializable-closure\n```\n\n### Usage\n\nYou may serialize a closure this way:\n\n```php\nuse Laravel\\SerializableClosure\\SerializableClosure;\n\n$closure = fn () =\u003e 'james';\n\n// Recommended\nSerializableClosure::setSecretKey('secret');\n\n$serialized = serialize(new SerializableClosure($closure));\n$closure = unserialize($serialized)-\u003egetClosure();\n\necho $closure(); // james;\n```\n\n### Caveats\n\n* Anonymous classes cannot be created within closures.\n* Attributes cannot be used within closures.\n* Serializing closures on REPL environments like Laravel Tinker is not supported.\n* Serializing closures that reference objects with readonly properties is not supported.\n\n## Contributing\n\nThank you for considering contributing to Serializable Closure! The contribution guide can be found in the [Laravel documentation](https://laravel.com/docs/contributions).\n\n## Code of Conduct\n\nIn order to ensure that the Laravel community is welcoming to all, please review and abide by the [Code of Conduct](https://laravel.com/docs/contributions#code-of-conduct).\n\n## Security Vulnerabilities\n\nPlease review [our security policy](https://github.com/laravel/serializable-closure/security/policy) on how to report security vulnerabilities.\n\n## License\n\nSerializable Closure is open-sourced software licensed under the [MIT license](LICENSE.md).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flaravel%2Fserializable-closure","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flaravel%2Fserializable-closure","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flaravel%2Fserializable-closure/lists"}