{"id":24518555,"url":"https://github.com/dperrymorrow/auto","last_synced_at":"2025-03-15T11:12:51.535Z","repository":{"id":140595161,"uuid":"1479047","full_name":"dperrymorrow/auto","owner":"dperrymorrow","description":"Code Igniter load on demand spark","archived":false,"fork":false,"pushed_at":"2011-07-01T18:36:12.000Z","size":94,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-22T01:43:04.984Z","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":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dperrymorrow.png","metadata":{"files":{"readme":"README.markdown","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":"2011-03-14T16:38:37.000Z","updated_at":"2013-12-07T11:41:38.000Z","dependencies_parsed_at":"2023-03-11T22:26:13.541Z","dependency_job_id":null,"html_url":"https://github.com/dperrymorrow/auto","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dperrymorrow%2Fauto","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dperrymorrow%2Fauto/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dperrymorrow%2Fauto/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dperrymorrow%2Fauto/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dperrymorrow","download_url":"https://codeload.github.com/dperrymorrow/auto/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243719398,"owners_count":20336607,"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":"2025-01-22T01:43:12.671Z","updated_at":"2025-03-15T11:12:51.516Z","avatar_url":"https://github.com/dperrymorrow.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Auto\nVery simple library, but yet it alleviates the need to ever load a model, library, spark, or helper again.\n\n## if you are using CI 2.0.2 you need to read this article before using my, or any other sparks for that matter. 2.0.2 has a bug with the loader class that breaks the sparks MY_Loader extension thereof. [http://codefury.net/2011/05/getsparks-org-beta-released-big-changes/](http://codefury.net/2011/05/getsparks-org-beta-released-big-changes/)\n\n\n## Features Overview\n\n- can access your CI instances from anywhere in your app using the _Auto::inst()_ static method\n- no need to use the loader class manually when this spark is installed\n- will never load anything more than once. \n- if the instance exists, its returned, if not it's loaded, instantiated as a CI var and returned. \n\n## Controller Usage\n( x.x indicates the version you have installed on your build )\n    \n\t// from some controller \n\t\n\tfunction __construct()\n\t{\n\t\t$this-\u003eload-\u003espark( 'auto/x.x' );\n\t}\n\t\n\tfunction get_users()\n\t{\n\t\t$this-\u003eauto-\u003eyour_model-\u003esome_method();\n\t\t//notice that I never loaded \"your_model\"?\n\t}\n\n## From anywhere \n\t\n\tfunction some_method()\n\t{\n\t\t/*\n\t\t* you have reference to CI instances from anywhere, \n\t\t* if it does not exist its created on the fly for you.\n\t\t*/\n\t\t$msg = Auto::inst()-\u003elang-\u003eline( 'language_key' );\n\t\t// much less verbose to do something like using models within other models \n\t}\n\t\n## Loading Helpers on demand\nThe below example is from a view, but could be anywhere.\n\nThe \\_helper suffix is not needed in all cases, but if you are in site controller, and trying to load site\\_helper dynamically, then you would need the suffix to prevent collision, thus it's better to get in the habit of using **Form\\_helper::form\\_open\\_();** instead of **Form::form_open();**\n\n    /*\n\t* load helpers only when each method is used\n \t* the classname tells Auto which helper file to load, \n    * in this case url_helper would be Url::desired_method()\n    */\n\n\techo Url_helper::anchor( 'http://www.google.com', 'Go to google' ); \n\techo Text_helper::character_limiter( 'Lorem ipsum dolor sit amet, consectetur adipisicing', 10 );\n\t\n\t// can call libraries ( instantiated or not ) from views as well.\n\t$data = array( array('Name', 'Color', 'Size') );\n\techo Auto::inst()-\u003etable-\u003egenerate( $data );\n\t// or if in CI scope...\n\techo $this-\u003eauto-\u003etable-\u003egenerate( $data );\n\t\n## Loading sparks on demand\nthe highest version folder in the spark folder will be loaded.\n\n    // if the spark is a library you can method chain such as\n    Auto::inst()-\u003eexample_spark-\u003esome_lib_method();\n\n\t/*\n\t* but, if its just helpers, you will have to call those as you normally would, \n\t* so you dont gain a whole lot in this case vs loading manually, only havig to know the version #\n\t*/\n\tAuto::inst()-\u003eexample_spark;\n\tsome_spark_helper_method();\n\t\n\n- [Log Issues or Suggestions](https://github.com/dperrymorrow/auto/issues)\n- [Follow me on Twitter](http://twitter.com/dperrymorrow)\n\n\n\t\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdperrymorrow%2Fauto","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdperrymorrow%2Fauto","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdperrymorrow%2Fauto/lists"}