1. Go to this page and download the library: Download danharrin/squire 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/ */
danharrin / squire example snippets
use Squire\Models\Country;
Country::all(); // Get information about all countries.
Country::find('us'); // Get information about the United States.
Country::where('name', 'like', 'a%')->get(); // Get information about all countries beginning with the letter "a".
namespace App\Models;
use Squire\Models\Country as SquireCountry;
class Country extends SquireCountry
{
public function users()
{
return $this->hasMany(User::class);
}
}
use App\Models\User;
use Squire\Models\Country;
Country::resolveRelationUsing('users', function (Country $country) {
return $country->hasMany(User::class);
});
namespace App\Models;
use Squire\Models\Country as SquireCountry;
class Country extends SquireCountry
{
protected $map = [
'dial_code' => 'calling_code',
];
}
use App\Models\Country;
Country::find('us')->dial_code; // 1
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.