What's the difference between a Contract in Laravel and an Interface in PHP?

后端 未结 4 1636
执念已碎
执念已碎 2021-01-08 00:04

As far as I can tell, Laravel refers to the interfaces it extends as Contracts because they are used by Laravel. But this seems a bit like circular reasoning. There is no va

4条回答
  •  清酒与你
    2021-01-08 00:40

    As others have said, that is just a fancy word for Interfaces, but I think that Taylor made that decision to make it more personal.

    What I mean by personal is that interface it's a very broad/common word on programming language, you have your interfaces, libraries (that you might be using) have their own interfaces and so on.

    Contracts you just assume as the Laravel interfaces it's like a wrapper or alias for all the Interfaces that belong to this repo.

提交回复
热议问题