{"id":13560164,"url":"https://github.com/rougin/spark-plug","last_synced_at":"2025-07-27T19:36:40.279Z","repository":{"id":33718241,"uuid":"37372016","full_name":"rougin/spark-plug","owner":"rougin","description":"Codeigniter 3 projects as variables.","archived":false,"fork":false,"pushed_at":"2024-10-21T13:41:39.000Z","size":90,"stargazers_count":15,"open_issues_count":0,"forks_count":5,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-10-30T06:24:46.962Z","etag":null,"topics":["codeigniter-library","core-library","php-library","spark-plug"],"latest_commit_sha":null,"homepage":"https://roug.in/spark-plug/","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/rougin.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2015-06-13T13:14:48.000Z","updated_at":"2024-10-21T13:40:26.000Z","dependencies_parsed_at":"2024-11-14T18:45:58.616Z","dependency_job_id":null,"html_url":"https://github.com/rougin/spark-plug","commit_stats":{"total_commits":53,"total_committers":2,"mean_commits":26.5,"dds":"0.018867924528301883","last_synced_commit":"40e4d5e2de100ecdb93693bcbcda3fa84c385f8a"},"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rougin%2Fspark-plug","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rougin%2Fspark-plug/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rougin%2Fspark-plug/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rougin%2Fspark-plug/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rougin","download_url":"https://codeload.github.com/rougin/spark-plug/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":230454427,"owners_count":18228392,"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":["codeigniter-library","core-library","php-library","spark-plug"],"created_at":"2024-08-01T13:00:38.624Z","updated_at":"2024-12-19T15:08:39.709Z","avatar_url":"https://github.com/rougin.png","language":"PHP","readme":"# Spark Plug\n\n[![Latest Version on Packagist][ico-version]][link-packagist]\n[![Software License][ico-license]][link-license]\n[![Build Status][ico-build]][link-build]\n[![Coverage Status][ico-coverage]][link-coverage]\n[![Total Downloads][ico-downloads]][link-downloads]\n\nA special package that returns an application based on [Codeigniter 3](https://codeigniter.com/) as a single variable. Might be useful when testing a `Codeigniter 3` project to frameworks such as [PHPUnit](https://phpunit.de/).\n\n## Installation\n\nInstall `Spark Plug` through [Composer](https://getcomposer.org/):\n\n``` bash\n$ composer require rougin/spark-plug\n```\n\n## Basic Usage\n\n### Using the `Instance` helper\n\n``` php\n$ci = Rougin\\SparkPlug\\Instance::create();\n\n// You can now use the CI_Controller instance\n$ci-\u003eload-\u003ehelper('inflector');\n```\n\n\u003e [!NOTE]\n\u003e Instead of `CI_Controller`, it returns `Rougin\\SparkPlug\\Controller` for type-hinting its helpers and libraries.\n\n### Using the `SparkPlug` class\n\n``` php\nuse Rougin\\SparkPlug\\SparkPlug;\n\n$sparkplug = new SparkPlug($GLOBALS, $_SERVER);\n\n$ci = $sparkplug-\u003einstance();\n\n// The Inflector helper is now loaded ---\n$ci-\u003eload-\u003ehelper('inflector');\n// --------------------------------------\n```\n\n### Modify constants to be defined\n\n``` php\nuse Rougin\\SparkPlug\\SparkPlug;\n\n$sparkplug = new SparkPlug($GLOBALS, $_SERVER);\n\n// Set the value of the APPPATH constant ---\n$sparkplug-\u003eset('APPPATH', '/path/to/app');\n// -----------------------------------------\n\n$ci = $sparkplug-\u003einstance();\n```\n\nAvailable constants that can be modified:\n\n* `APPPATH`\n* `VENDOR`\n* `VIEWPATH`\n\n\u003e [!NOTE]\n\u003e If setting a new `APPPATH` value, the value of `VIEWPATH` will be set to `APPPATH/views`.\n\n### Mock `CI_Controller` for unit testing\n\n``` php\nuse Rougin\\SparkPlug\\Instance;\n\nclass SampleTest extends \\PHPUnit_Framework_TestCase\n{\n    public function testCodeigniterInstance()\n    {\n        // Directory path to the test application\n        $application = __DIR__ . '/TestApp';\n\n        // Instance::create($path, $_SERVER, $GLOBALS)\n        $ci = Instance::create($application);\n\n        $this-\u003eassertInstanceOf('CI_Controller', $ci);\n    }\n}\n```\n\n## Changelog\n\nPlease see [CHANGELOG][link-changelog] for more information what has changed recently.\n\n## Testing\n\n``` bash\n$ composer test\n```\n\n## Credits\n\n- [All contributors][link-contributors]\n\n## License\n\nThe MIT License (MIT). Please see [LICENSE][link-license] for more information.\n\n[ico-build]: https://img.shields.io/github/actions/workflow/status/rougin/spark-plug/build.yml?style=flat-square\n[ico-coverage]: https://img.shields.io/codecov/c/github/rougin/spark-plug?style=flat-square\n[ico-downloads]: https://img.shields.io/packagist/dt/rougin/spark-plug.svg?style=flat-square\n[ico-license]: https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square\n[ico-version]: https://img.shields.io/packagist/v/rougin/spark-plug.svg?style=flat-square\n\n[link-build]: https://github.com/rougin/spark-plug/actions\n[link-changelog]: https://github.com/rougin/spark-plug/blob/master/CHANGELOG.md\n[link-contributors]: https://github.com/rougin/spark-plug/contributors\n[link-coverage]: https://app.codecov.io/gh/rougin/spark-plug\n[link-downloads]: https://packagist.org/packages/rougin/spark-plug\n[link-license]: https://github.com/rougin/spark-plug/blob/master/LICENSE.md\n[link-packagist]: https://packagist.org/packages/rougin/spark-plug","funding_links":[],"categories":["Libraries"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frougin%2Fspark-plug","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frougin%2Fspark-plug","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frougin%2Fspark-plug/lists"}