PHP code example of azen / apify-lumen

1. Go to this page and download the library: Download azen/apify-lumen 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/ */

    

azen / apify-lumen example snippets


namespace App\Models;
class Nation extends \Apify\Models\BaseModel {
    protected $table = 'location_nation';
    public function cities() {
        return $this->hasMany('App\Models\City', 'nation_id', id);
    }
}

namespace App\Models;
class City extends \Apify\Models\BaseModel {
    protected $table = 'location_city';
    public function nation() {
        return $this->belongsTo('App\Models\Nation', 'nation_id');
    }
    public function districts() {
        return $this->hasMany('App\Models\District', 'city_id', id);
    }
}

namespace App\Models;
class District extends \Apify\Models\BaseModel {
    protected $table = 'location_district';
    public function city() {
        return $this->belongsTo('App\Models\City', 'city_id');
    }
}    

/api/post?page_id=2&page_size=20

/api/post?sorts=user_id

/api/post?fields=id,content,user_id,sum(view_count) as view_sum

/api/post?filters=user_id=1,status={enabled;pending},tile~hello,view_count!=null

/api/nation?embeds=cities

/api/city?embeds=nation,districts

/api/district?embeds=city

/api/post?metric=get

/api/post?metric=first

/api/post?metric=count

/api/post?metric=increment&fields=view_count