{"id":19706725,"url":"https://github.com/unisharp/laravel-datacarrier","last_synced_at":"2025-06-25T00:43:06.526Z","repository":{"id":57075558,"uuid":"43539074","full_name":"UniSharp/laravel-datacarrier","owner":"UniSharp","description":"session-wide static data storage.","archived":false,"fork":false,"pushed_at":"2017-03-27T19:53:35.000Z","size":14,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-02-27T17:37:37.100Z","etag":null,"topics":[],"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/UniSharp.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-10-02T06:39:15.000Z","updated_at":"2016-01-16T16:54:44.000Z","dependencies_parsed_at":"2022-08-24T14:55:44.300Z","dependency_job_id":null,"html_url":"https://github.com/UniSharp/laravel-datacarrier","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/UniSharp%2Flaravel-datacarrier","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/UniSharp%2Flaravel-datacarrier/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/UniSharp%2Flaravel-datacarrier/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/UniSharp%2Flaravel-datacarrier/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/UniSharp","download_url":"https://codeload.github.com/UniSharp/laravel-datacarrier/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/UniSharp%2Flaravel-datacarrier/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259113114,"owners_count":22807199,"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":[],"created_at":"2024-11-11T21:36:41.153Z","updated_at":"2025-06-25T00:43:06.491Z","avatar_url":"https://github.com/UniSharp.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Laravel Data Carrier\n[![Build Status](https://travis-ci.org/UniSharp/laravel-datacarrier.svg)](https://travis-ci.org/UniSharp/laravel-datacarrier)\n[![Version](https://img.shields.io/packagist/v/unisharp/laravel-datacarrier.svg)](https://packagist.org/packages/unisharp/laravel-datacarrier)\n[![License](https://img.shields.io/github/license/unisharp/laravel-datacarrier.svg)](https://packagist.org/packages/unisharp/laravel-datacarrier)\n[![Total Downloads](https://img.shields.io/packagist/dt/unisharp/laravel-datacarrier.svg)](https://packagist.org/packages/unisharp/laravel-datacarrier)\n\n### Introduction\n\nProvide an object as Facade to put all global variables togetther, clean your code. Normally we use it to passing variables from Controller to View.\n\nAnd you can extend your formating method to help you format global data\n\n### Install Data Carrier\n\ncomposer.json:\n\n    \"require\" : {\n        \"unisharp/laravel-datacarrier\" : \"~1.0\"\n    }, \n    \"repositories\": {\n        \"type\": \"git\",\n        \"url\": \"https://github.com/UniSharp/laravel-datacarrier.git\n    }\n\nsave it and then \n\n    composer update    \n\n### Set ServiceProvider and Set Facade\n\n#### in config/app.php:\n\n* ServiceProfider\n\n        Unisharp\\DataCarrier\\DataCarrierServiceProvider::class,\n        \n\n* alias\n\n        'DataCarrier' =\u003e Unisharp\\DataCarrier\\DataCarrierFacade::class,\n        \n        \n### Usage\n\n* get and set global data\n\n    you can use Facade to set and get items\n\n        \\DataCarrier::set('key', 1); // ['a' =\u003e 1]\n    \n        \\DataCarrier::get('key'); // 1\n    \n        // you can set a default value for get method\n    \n        \\DataCarrier::get('key', 0); // if you cannot get it, it will return 0\n\n        $var = d('key', 0); // Quick access by d() helper.\n        \n        \\DataCarrier::all(); // it will get an array with all items\n    \n    you can also use dot to seperate array\n    \n        # [ \n        #    'a' =\u003e [\n        #        'b' =\u003e 'value'\n        #    ]\n        # ]\n        \n        \\DataCarrier::get('a.b'); // 'value'\n    \n* customize your format method (Add method into Data Carrier)\n\n        \\DataCarrier::extend('format', function ($data) {\n            return number_format($data);\n        })\n    \n    \n* format your data\n\n        # ['num' =\u003e '100000']\n        \\DataCarrier::format('num') // 100,000\n        \n### Helper can use helper to set, get your data \n\n* get, set function\n    \n        carrier_set('num', 1); // ['a' =\u003e 1]\n        carrier_get('num'); // 1\n    \n* use carrier() to muniplate container\n\n        carrier() // it's just return App::make('DataCarrier')\n    \n\n### Another way to work with DataCarier\n\n* get, set can replace by it\n\n         carrier('num')-\u003eget();\n         carrier('num')-\u003eset(5);\n     \n* extend your formating method\n\n        carrier()-\u003eextend('format', function ($data) {\n            return number_format($data);\n        })\n\n* use your formatting method\n\n        carrier('num')-\u003eformat(); // it will return formating result\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Funisharp%2Flaravel-datacarrier","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Funisharp%2Flaravel-datacarrier","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Funisharp%2Flaravel-datacarrier/lists"}