@@ -55,17 +55,31 @@ public static function defaultTileLayer(): TileLayer
5555 protected $ minZoom = 0 ;
5656
5757
58+ /**
59+ * @array $curlOptions Array of curl options
60+ */
61+ protected $ curlOptions = [];
62+
63+ /**
64+ * @bool $failCurlOnError If true, curl will throw an exception on error.
65+ */
66+ protected $ failCurlOnError = false ;
67+
5868 /**
5969 * TileLayer constructor
6070 * @param string $url tile server url with placeholders (`x`, `y`, `z`, `r`, `s`)
6171 * @param string $attributionText tile server attribution text
6272 * @param string $subdomains tile server subdomains
73+ * @param array $curlOptions Array of curl options
74+ * @param bool $failCurlOnError If true, curl will throw an exception on error.
6375 */
64- public function __construct (string $ url , string $ attributionText , string $ subdomains = 'abc ' )
76+ public function __construct (string $ url , string $ attributionText , string $ subdomains = 'abc ' , array $ curlOptions = [], bool $ failCurlOnError = false )
6577 {
6678 $ this ->url = $ url ;
6779 $ this ->attributionText = $ attributionText ;
6880 $ this ->subdomains = \str_split ($ subdomains );
81+ $ this ->curlOptions = $ curlOptions ;
82+ $ this ->failCurlOnError = $ failCurlOnError ;
6983 }
7084
7185 /**
@@ -181,7 +195,7 @@ public function getTile(float $x, float $y, int $z, int $tileSize): Image
181195 return Image::newCanvas ($ tileSize , $ tileSize );
182196 }
183197
184- $ tile = Image::fromCurl ($ this ->getTileUrl ($ x , $ y , $ z ));
198+ $ tile = Image::fromCurl ($ this ->getTileUrl ($ x , $ y , $ z ), $ this -> curlOptions , $ this -> failCurlOnError );
185199
186200 if ($ this ->opacity > 0 && $ this ->opacity < 1 ) {
187201 $ tile ->setOpacity ($ this ->opacity );
0 commit comments