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

yayuj's avatar

Different between service and service provider

It might be a silly question, but watching some videos I often see @JeffreyWay refers to service and sometimes to service provider, but what is the different between them?

0 likes
2 replies
JarekTkaczyk's avatar
Level 53

@yayuj A service is a piece of code that has its own purpose. It may be a validation service, authentication service and so on - a class or bundle that you pass data to and get something in return or simply ask to do some work, depending on the service.

Read about the architecture and design patterns - you can start here: https://laracasts.com/recommended-reading

ServiceProvider on the other hand is a class used to bootstrap the service, ie. prepare it, read some config, bind an implementation etc.

Read more in the Laravel docs http://laravel.com/docs/4.2/ioc#service-providers

5 likes

Please or to participate in this conversation.