PHP code example of iambib / collection-extender
1. Go to this page and download the library: Download iambib/collection-extender library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
iambib / collection-extender example snippets
$collection->recursive();
$collection->pushToKey($key, $value, ?$recursive);
$collection->toModel(?$model_class);
$collection->input($keys,?$default);
$collection->morphTo($object_class)
Illuminate\Support\Collection {#354 ▼
#items: array:2 [▼
"foo" => "bar"
"bar" => Illuminate\Support\Collection {#358 ▼
#items: array:2 [▼
"foo" => "Lorem"
"bar" => "Ipsum"
]
#escapeWhenCastingToString: false
}
]
#escapeWhenCastingToString: false
}
Illuminate\Support\Collection {#354 ▼
#items: array:2 [▼
"foo" => "bar"
"bar" => Illuminate\Support\Collection {#358 ▼
#items: array:2 [▼
"foo" => "Lorem"
"bar" => "Ipsum"
]
#escapeWhenCastingToString: false
}
]
#escapeWhenCastingToString: false
}
Illuminate\Support\Collection {#354 ▼
#items: array:2 [▼
"foo" => array:2 [▼
0 => "bar"
1 => "newValue"
]
"bar" => Illuminate\Support\Collection {#358 ▼
#items: array:2 [▼
"foo" => "Lorem"
"bar" => "Ipsum"
]
#escapeWhenCastingToString: false
}
]
#escapeWhenCastingToString: false
}
Illuminate\Support\Collection {#352 ▼
#items: array:2 [▼
"foo" => "bar"
"bar" => array:2 [▼
"foo" => "Lorem"
"bar" => "Ipsum"
]
]
#escapeWhenCastingToString: false
}
Illuminate\Support\Collection {#352 ▼
#items: array:2 [▼
"foo" => "bar"
"bar" => array:2 [▼
"foo" => "Lorem"
"bar" => "Ipsum"
]
]
#escapeWhenCastingToString: false
}
Illuminate\Support\Collection {#354 ▼
#items: array:3 [▼
"status" => true
"data" => array:2 [▼
"foo" => "bar"
"bar" => array:2 [▼
"foo" => "Lorem"
"bar" => "Ipsum"
]
]
"message" => "Success"
]
#escapeWhenCastingToString: false
}