Map layers are contained within an MgMap object. To list the layers in a map, use the MgMap::GetLayers() method. This returns an MgLayerCollection object.
To retrieve a single layer, use the MgLayerCollection::GetItem method with either an integer index or a layer name. The layer name is the name as defined in the map, not the name of the layer definition in the repository.
For example:
$layer = $layers->GetItem('Roads');