knuckleswtf / knuckleswtf/scribe

Refactor for easier customization

Open
#821 3 comments 0 reactions 0 assignees View on GitHub
question
Dominant language
PHP
Stars
2.3k
Forks
357
PR merge metrics
No merged PRs in 30d

Description

### Scribe version

4.29.0

### Your question

I'm wondering it's possible to do some code refactoring to allow easier customization

for example in the `GenerateDocumentation` command you instantiate the `Writer` class using the new keyword.
Why not use the service container to instantiate it this way it would be easier to custom bind it. (of course there's a lot of other options like adding it to the config file but I think the container is the fastest and easiest solution)

Same for instantiating the `CustomTranslationsLoader` in the `ScribeServiceProvider`.

Btw these are the classes I had to customize in order to get the localization to work the way I want it to.
This includes:
- Setting the `scribe.php` lang file under the correct locale directory (Had to customize `CustomTranslationsLoader`)
- Generating the docs blade file under a locale directory inside the views folder for example `resources/views/scribe/en/index.blade.php` (Had to customize the `Writer`)

### Docs

- [X] I've checked [the docs](https://scribe.knuckles.wtf/laravel), the [troubleshooting guide](https://scribe.knuckles.wtf/laravel/troubleshooting), and [existing issues](https://github.com/knuckleswtf/scribe/issues?q=is%3Aissue+), but I didn't find a solution

Contributor guide

Open the contributing guide

Research direction

Start by reading the GenerateDocumentation command, Writer, CustomTranslationsLoader, and ScribeServiceProvider to trace how these classes are instantiated. Compare the current construction paths with the requested service-container customization for Writer and CustomTranslationsLoader. Done should make both classes replaceable through bindings while preserving the described localized documentation behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
laravel, php
Domain
developer-experience, documentation
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.