{"id":21936873,"url":"https://github.com/pherum/laravel-bbcode","last_synced_at":"2025-04-22T12:07:12.383Z","repository":{"id":57038721,"uuid":"115532859","full_name":"PheRum/laravel-bbcode","owner":"PheRum","description":"Parse your BBCode easy with laravel-bbcode","archived":false,"fork":false,"pushed_at":"2021-04-11T20:42:25.000Z","size":17,"stargazers_count":23,"open_issues_count":1,"forks_count":9,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-11-08T06:20:24.650Z","etag":null,"topics":["bbcode","laravel","laravel-bbcode"],"latest_commit_sha":null,"homepage":null,"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/PheRum.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-12-27T15:14:14.000Z","updated_at":"2024-08-08T17:01:43.000Z","dependencies_parsed_at":"2022-08-24T00:51:12.309Z","dependency_job_id":null,"html_url":"https://github.com/PheRum/laravel-bbcode","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PheRum%2Flaravel-bbcode","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PheRum%2Flaravel-bbcode/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PheRum%2Flaravel-bbcode/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PheRum%2Flaravel-bbcode/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/PheRum","download_url":"https://codeload.github.com/PheRum/laravel-bbcode/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":227017747,"owners_count":17717797,"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":["bbcode","laravel","laravel-bbcode"],"created_at":"2024-11-29T01:16:41.226Z","updated_at":"2024-11-29T01:16:41.940Z","avatar_url":"https://github.com/PheRum.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Laravel BBCode\n\n[![Latest Version on Packagist][ico-version]][link-packagist]\n[![Software License][ico-license]](LICENSE.md)\n[![Build Status][ico-travis]][link-travis]\n[![StyleCI][ico-styleci]][link-styleci]\n[![Quality Score][ico-code-quality]][link-code-quality]\n[![Total Downloads][ico-downloads]][link-downloads]\n\n\n## Description\n\nParse your BBCode easy with laravel-bbcode\n\n## Install\n\nVia Composer\n\n``` bash\ncomposer require pherum/laravel-bbcode\n```\n\n## Usage\nTo parse some text it's as easy as this!\n``` php\n$bbcode = new PheRum\\BBCode\\BBCodeParser;\n\necho $bbcode-\u003eparse('[b]Bold Text![/b]');\n// \u003cstrong\u003eBold Text!\u003c/strong\u003e\n```\nWould like the parser to not use all bbcodes? Just do like this.\n``` php\n$bbcode = new PheRum\\BBCode\\BBCodeParser;\n\necho $bbcode-\u003eonly('bold', 'italic')\n            -\u003eparse('[b][u]Bold[/u] [i]Italic[/i]![/b]');\n            // \u003cstrong\u003e[u]Bold[/u] \u003cem\u003eItalic\u003c/em\u003e!\u003c/strong\u003e\n\necho $bbcode-\u003eexcept('bold')\n            -\u003eparse('[b]Bold[/b] [i]Italic[/i]');  // [b]Bold[/b] \u003cem\u003eItalic\u003c/em\u003e\n```\n\nBy default the parser is case sensitive. But if you would like the parser to accept tags like `` [B]Bold Text[/B] `` it's really easy.\n``` php\n$bbcode = new PheRum\\BBCode\\BBCodeParser;\n\n// Case insensitive\necho $bbcode-\u003eparse('[b]Bold[/b] [I]Italic![/I]', true); // \u003cstrong\u003eBold\u003c/strong\u003e \u003cem\u003eItalic!\u003c/em\u003e\n\n// Or like this\n\necho $bbcode-\u003eparseCaseInsensitive('[b]Bold[/b] [i]Italic[/i]');\n     // \u003cstrong\u003eBold\u003c/strong\u003e \u003cem\u003eItalic!\u003c/em\u003e\n```\nYou could also make it more explicit that the parser is case sensitive by using another helper function.\n``` php\n    $bbcode = new PheRum\\BBCode\\BBCodeParser;\n\n    echo $bbcode-\u003eparseCaseSensitive('[b]Bold[/b] [I]Italic![/I]');\n         // \u003cstrong\u003eBold\u003c/strong\u003e [I]Italic![/I]\n```\n\nIf you would like to completely remove all BBCode it's just one function call away.\n``` php\n    $bbcode = new PheRum\\BBCode\\BBCodeParser;\n\n    echo $bbcode-\u003estripBBCodeTags('[b]Bold[/b] [i]Italic![/i]');  // Bold Italic!\n```\n\n## Laravel integration\nThe integration into Laravel is really easy, and the method is the same for both Laravel 5.\nJust open your ``app.php`` config file.\n\nIn there you just add this to your providers array\n``` php\nPheRum\\BBCode\\BBCodeServiceProvider::class,\n```\n\nAnd this to your facades array\n``` php\n'BBCode' =\u003e PheRum\\BBCode\\Facades\\BBCode::class,\n```\n\nThe syntax is the same as if you would use it in vanilla PHP but with the ``BBCode::`` before the methods.\nHere are some examples.\n``` php\n// Simple parsing\necho BBCode::parse('[b]Bold Text![/b]');\n\n// Limiting the parsers with the only method\necho BBCode::only('bold', 'italic')\n        -\u003eparse('[b][u]Bold[/u] [i]Italic[/i]![/b]'); // \u003cstrong\u003e[u]Bold[/u] \u003cem\u003eItalic\u003c/em\u003e!\u003c/strong\u003e\n\n// Or the except method\necho BBCode::except('bold')\n        -\u003eparse('[b]Bold[/b] [i]Italic[/i]'); // [b]Bold[/b] \u003cem\u003eItalic\u003c/em\u003e\n```\n\n## Testing\n\n``` bash\nphpunit\n```\n\n## Contributing\n\nPlease see [CONTRIBUTING](CONTRIBUTING.md) for details.\n\n## Credits\n\n- [PheRum](https://github.com/pherum)\n- [All Contributors](../../contributors)\n\n## License\n\nThe MIT License (MIT). Please see [License File](LICENSE.md) for more information.\n\n[ico-version]: https://img.shields.io/packagist/v/pherum/laravel-bbcode.svg?style=flat-square\n[ico-license]: https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square\n[ico-travis]: https://img.shields.io/travis/pherum/laravel-bbcode/master.svg?style=flat-square\n[ico-styleci]: https://styleci.io/repos/65690597/shield\n[ico-code-quality]: https://img.shields.io/scrutinizer/g/pherum/laravel-bbcode.svg?style=flat-square\n[ico-downloads]: https://img.shields.io/packagist/dt/pherum/laravel-bbcode.svg?style=flat-square\n\n[link-packagist]: https://packagist.org/packages/PheRum/laravel-bbcode\n[link-travis]: https://travis-ci.org/PheRum/laravel-bbcode\n[link-styleci]: https://styleci.io/repos/115532859\n[link-code-quality]: https://scrutinizer-ci.com/g/PheRum/laravel-bbcode\n[link-downloads]: https://packagist.org/packages/PheRum/laravel-bbcode\n[link-author]: https://github.com/PheRum\n[link-contributors]: ../../contributors","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpherum%2Flaravel-bbcode","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpherum%2Flaravel-bbcode","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpherum%2Flaravel-bbcode/lists"}