Get All sources list Multi Source Inventory (MSI) Programmatically Magento 2.

Multi-source inventory (MSI) Was Introduced from Magento 2.3 Version.

MSI contains multiple sources related to store location.

If any website has multiple selling locations and that contains multiple inventory locations to sell products, you need to create multiple sources for the item to ship.

Magento Out-of-the-box comes with Default Source with MSI installation.

Related Table in Database to store sources entry:
* inventory_source

What are Sources in MSI?
Sources refer to inventory management in physical locations. Each source is a Warehouse (or brick-mortar store, drop shipper or distribution center) that contains products to ship.

If you have created multiple sources for the Magento system, You can fetch the list of sources available for a system via programmatically using a given code.

I have created a simple Model class to get all the sources,

You can call the function to get a list of available sources,

The Output is an array of lists of sources defined in the system.

You can get required data from the output like source name, is enable, city, state, country_id, email and phone.

This is the basic example of retrieving the list of sources in Magento 2 MSI.