Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

JackJones's avatar

Could someone review my Service Provider?

I'm completely self taught at PHP and Laravel but I'm trying to develop something that later maybe other people will help with (they're currently doing Laravel for their job but they're junior developers in training and only started two weeks ago so they can't really help atm)

Here is what it looks like

<?php

namespace App\Providers;

use App\Contracts\Extractors\WikidataExtractorContract;
use App\Contracts\Translation\TranslationContract;
use App\Models\Translation;
use App\Services\Translation\TranslationService;
use Illuminate\Support\ServiceProvider;

class TranslationServiceProvider extends ServiceProvider
{
    /**
     * Register services.
     *
     * @return void
     */
    public function register()
    {
        $this->app->bind(TranslationContract::class, function ($app) {
            return new TranslationService(new Translation, $app[WikidataExtractorContract::class]);
        });

        $this->app->alias(TranslationContract::class, 'translation');
    }
}

Is that typically what you would expect to see?

Thanks Jack

0 likes
1 reply
usman's avatar

@jackjones Yes, this definitely is your typical service provider. There is nothing wrong there. Good luck!

Please or to participate in this conversation.