Drupal's Typed Data API by example

Overview

Drupal's Typed Data API by example

This repository aims to help show use cases and various exercises with using Drupal's Typed Data API.

The Typed Data API was created to provide developers with a consistent way of interacting with data in different ways.

Trying it out!

All of the examples can be run to see sample outputs.

For example, the following will run the emails example in strings and print any of the additional output provided for context.

php strings/email.php
You might also like...
18Laravel ReactJS Package to simplify sending data from Laravel back-end to front-end built to Facebook ReactJS.

Laravel ReactJS This is a package that we wrote to use on our Laravel applications that use React from Facebook. Our goal is deal with the SEO problem

Powerful data objects for Laravel
Powerful data objects for Laravel

Powerful data objects for Laravel This package enables the creation of rich data objects which can be used in various ways. Using this package you onl

PHP template engine that uses data-attributes and keeps HTML templates valid and clean

Dataplater PHP template engine that uses data-attributes and keeps HTML templates valid and clean. Scroll down to see a usage example. Install compose

Data providers encapsulate logic for Inertia views, keep your controllers clean and simple.

Laravel Data Providers for Inertia.js Data providers encapsulate logic for Inertia views, keep your controllers clean and simple. Installation We assu

PHP Framework for building scalable API's on top of Laravel.
PHP Framework for building scalable API's on top of Laravel.

Apiato Build scalable API's faster | With PHP 7.2.5 and Laravel 7.0 Apiato is a framework for building scalable and testable API-Centric Applications

Rest API boilerplate for Lumen micro-framework.
Rest API boilerplate for Lumen micro-framework.

REST API with Lumen 5.5 A RESTful API boilerplate for Lumen micro-framework. Features included: Users Resource OAuth2 Authentication using Laravel Pas

PHP Framework for building scalable API's on top of Laravel.
PHP Framework for building scalable API's on top of Laravel.

Apiato Build scalable API's faster | With PHP 7.2.5 and Laravel 7.0 Apiato is a framework for building scalable and testable API-Centric Applications

This package provides an artisan command to generate a basic crud with Restful API support

NHRROB Crud Generator Package This package provides an artisan command to generate a basic crud composer install command: composer require nhrrob/crud

Generate dummy API endpoints from a simple PHP array.

Laravel Fake API Create placeholder API endpoints from a simple PHP array. LFA utilizes Faker for dummy data. Inspired by JSON Server. Installation To

Comments
  • Rename

    Rename "strings" directory

    The strings directory should contain more basic data types, and I cannot think of a better name.

    It's probably best to rename it to primitives and handle examples of all data types that implement \Drupal\Core\TypedData\PrimitiveInterface.

    That covers

    • integers
    • timestamps
    • time span (seconds, integer)
    • float
    • binary (resource)
    • string (plain)
    • email
    • datetime
    • uri
    • boolean
    opened by mglaman 0
  • Explain how TypeData can satisfy a Data Sync story

    Explain how TypeData can satisfy a Data Sync story

    Stop me if you've heard this before.

    I have products in my Drupal site, and products in another (maybe not Drupal) site. I want to run a process and sync the product data. Over time, I've learned that you can't just fire and forget that process. There is a strong need to have a series of reports that shows data that isn't properly synced, as well as vigorously report on any issues with the sync so we can fix whatever issue is leading to the data not syncing well. So that's the use case.

    When creating data sync reports it's important to answer the following questions:

    • Is there any data in datasource A that is not in datasource B?
    • Is there any data in datasource B that is not in datasource A?
    • When I do an operation (create/update/disable/delete), I need to record detailed error messages / validation errors (from either side/source) if anything goes wrong so I can figure out how to correct it.

    and maybe I could optimize performance by doing these checks during the process:

    • Create/Update logic, Does my product in datasource A exist in datasource B?
    • Skip Update logic, Is my product in datasource A have any updates for the product in datasource B?

    There are many programmatic approaches to solving the above questions. It would be nice to see a solution that used TypeData. I am imagining a solution that takes data from each datasource and converts them into a common data type so that:

    • direct comparisons can be easier
    • the size of the intermediate state could be much smaller that a fully hydrated node
    • ultimately be less code because of inherited getters/setters
    • maybe easier to write code that handles validation of individual properties.

    If you've got something like this already thought through, I'd say run with that. If not, I'm eager to help write some documentation on how to do this...as soon as I figure it out.

    example request 
    opened by cosmicdreams 8
  • Document methods on the typed data manager

    Document methods on the typed data manager

    The typed data manager has a few create methods and it can be confusing.

    Do I need create or do I need createInstance or createFromDataType

    Not to mention all of the other plugin manager methods.

    opened by mglaman 0
  • DataReferenceInterface examples

    DataReferenceInterface examples

    It'd be nice to see if this is possible to provide examples for. Drupal core only has \Drupal\Core\TypedData\Plugin\DataType\LanguageReference and \Drupal\Core\Entity\Plugin\DataType\EntityReference as examples.

    example request 
    opened by mglaman 0
Owner
Matt Glaman
Principal Software Engineer at @acquia
Matt Glaman
An example of Laravel app that runs in a docker container with RoadRunner

This repository contains an example of Laravel (PHP Framework) application that runs in a docker container with RoadRunner (high-performance PHP appli

Paramtamtam 117 Dec 20, 2022
Laravel Typical High-Load Example.

Laravel Typical High-Load Example 淺談基於 Laravel 框架的高流量、高併發網路應用架構的設計與效能優化。 摘要 網際網路的服務推陳出新,使用者的習性也不斷變化,使得網路應用服務必須面對極端的需求,例如電子商務中常見的商品限時、限量、促銷搶購或是演唱會搶票等,這

乾太 13 Aug 22, 2022
How to Create Laravel 8 Vue JS CRUD Example

About Project How to Create Laravel 8 Vue JS CRUD, how to implement vue js crud example with Laravel 8. how to Create a crude API in Laravel 8, for ex

Fadi Mathlouthi 1 Oct 22, 2021
Laravel 9 Vue Js flash message example

Laravel 9 Vue Js flash message example; Through this tutorial, i am going to show you how to display a flash messages with vue js components in laravel vue js apps.

Wesley Sinde 3 May 11, 2022
Example of create, update, delete and read operations in laravel 9 version.

Laravel 9 CRUD Example Example of create, update, delete and read operations in laravel 9 version. Download Step 1 (download the project.) git clone h

Ali Yılmaz 4 Aug 3, 2022
Laravel API starter Kit will provide you with the tools for making API's that everyone will love

Laravel API Starter Kit Laravel API starter Kit will provide you with the tools for making API's that everyone will love, API Authentication is alread

Jose Luis Fonseca 400 Dec 29, 2022
A Laravel 5.8 API Boilerplate to create a ready-to-use REST API in seconds.

Laravel API Boilerplate (JWT Edition) for Laravel 5.8 Laravel API Boilerplate is a "starter kit" you can use to build your first API in seconds. As yo

Francesco Malatesta 1.2k Dec 18, 2022
Hydra is a zero-config API boilerplate with Laravel Sanctum that comes with excellent user and role management API out of the box

Hydra - Zero Config API Boilerplate with Laravel Sanctum Hydra is a zero-config API boilerplate with Laravel Sanctum and comes with excellent user and

Hasin Hayder 858 Dec 24, 2022
LaraAdmin is a Open source Laravel Admin Panel / CMS which can be used as Admin Backend, Data Management Tool or CRM boilerplate for Laravel with features like Advanced CRUD Generation, Module Manager, Backups and many more.

LaraAdmin 1.0 LaraAdmin is a Open source CRM for quick-start Admin based applications with features like Advanced CRUD Generation, Schema Manager and

Dwij IT Solutions 1.5k Dec 29, 2022
A package for building Admin-Interfaces that help maintaining the data of your applications

A package for building Admin-Interfaces that help maintaining the data of your applications. It provides an intuitive interface and the tools needed to manage your project's Users, Models and free Forms for Pages, Settings etc.

null 808 Dec 31, 2022