{"id":16631037,"url":"https://github.com/mehedimi/new-instance","last_synced_at":"2025-03-11T21:22:09.181Z","repository":{"id":62526848,"uuid":"388352931","full_name":"mehedimi/new-instance","owner":"mehedimi","description":"Create a new instance of a class and chain method without storing it in a variable.","archived":false,"fork":false,"pushed_at":"2021-07-22T06:32:52.000Z","size":3,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-18T07:46:22.527Z","etag":null,"topics":["instance","php"],"latest_commit_sha":null,"homepage":"https://packagist.org/packages/mehedimi/new-instance","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mehedimi.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-07-22T06:29:29.000Z","updated_at":"2021-07-22T06:36:01.000Z","dependencies_parsed_at":"2022-11-02T14:02:21.316Z","dependency_job_id":null,"html_url":"https://github.com/mehedimi/new-instance","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mehedimi%2Fnew-instance","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mehedimi%2Fnew-instance/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mehedimi%2Fnew-instance/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mehedimi%2Fnew-instance/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mehedimi","download_url":"https://codeload.github.com/mehedimi/new-instance/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243113030,"owners_count":20238324,"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":["instance","php"],"created_at":"2024-10-12T04:50:37.814Z","updated_at":"2025-03-11T21:22:09.156Z","avatar_url":"https://github.com/mehedimi.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# New Instance\nCreate new instance of a class and chain method without storing in variable.\n\n## Installation\nTo install this package via `composer`, just run the following command on your terminal.\n```bash\ncomposer require mehedimi/new-instance\n```\n## Uses\nJust use the `Mehedi\\NewInstance\\NewInstance` trait in your any PHP class\n```php\n\u003c?php\nuse Mehedi\\NewInstance\\NewInstance;\n\nclass Post\n{\n    use NewInstance;\n    \n    public function find()\n    {\n        //\n    }\n}\n\n// Then \nPost::newInstance()-\u003efind();\n```\nOr you can create singleton instance of any PHP class.\n```php\n\u003c?php\n$post1 = Post::newSingleInstance();\n$post2 = Post::newSingleInstance();\n\n// Here $post1 and $post2 object are same\n```\nAlso, you can accept one or many arguments on class constructor\n```php\nuse Mehedi\\NewInstance\\NewInstance;\n\nclass Post\n{\n    use NewInstance;\n    \n    public function __construct($hello, $word)\n    {\n        //\n    }\n}\nPost::newSingleInstance('hello', 'word');\n// OR\nPost::newInstance('hello', 'word');\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmehedimi%2Fnew-instance","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmehedimi%2Fnew-instance","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmehedimi%2Fnew-instance/lists"}