Gsm Detector is a PHP package which allows to know the name of the GSM operator from phone number.
Installation
Usage

Using the package remains quite simple, you have to create a new instance of the GsmDetector class and define your different GSM networks and their assigned and / or reserved number blocks as if the following example:
You could define the length of assigned and / or reserved numbers according to your need with its static methods:
So this just uses the data provided and does a bunch of substring/prefix stuff? It doesn’t actually know anything about phone number assignment itself.
Okay

This only works for US networks. In the U.K. for example you can change network and keep the number and the blocks aren’t assigned in any reasonable groups initially anyway.

In the USA number portability is even more comprehensive than in the UK. You can bring your number between landlines and mobiles just as easily as between mobile operators.

However in the USA (and probably some other countries) there are live databases that will tell you the operating carrier for a specific number. They are useful. This class, on the other hand, is not.

Yes, you have to define the different allocated blocks yourself.
Thank you for your comments I think the package will really be used if it was totally self-contained.
It’s just checking the prefix?

In almost any developed country, and many others as well, you can bring your number from one carrier to the other, and then the prefix becomes useless for identifying the carrier.

So what is my operator? +46702346775? (Not my real number)
the number passed in parameter be without the dial code, the package does not provide the possibility of extracting the dial code before processing. Then will have to definied your different GSM networks and their assigned and / or reserved number blocks.

source