Skip to content

vahidForughi/simple-mapping-project

Repository files navigation

Simple Mapping Project

Sync data between api and database.

Installation

add packages:

composer install

database initialize:

php artisan migrate
php artisan db:seed

run server:

php artisan serve

basic auth

username: test@test.com
pass: password

Usage

config/mappers/sample.yml

config:
    url: "https://"
    fields:
        id:
            type: int
            key: id
        title:
            type: string
            key: name
        content:
            type: html
            key: body
        abilities:
            type: array
            key: permissions
        created_at:
            type: date
            key: generated_at

controller.php

$data = ApiManager::init('teams')
                ->fetch()   // you can setContent instead
                ->extractWithStrategy(new JsonStructure()) //  can use extractWithFactory('json') instead
                ->mapping(new TeamsMappingStrategy())
                ->getData();

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published