Download the PHP package agustincarmona/laravel-api-schema without Composer
On this page you can find all versions of the php package agustincarmona/laravel-api-schema. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download agustincarmona/laravel-api-schema
More information about agustincarmona/laravel-api-schema
Files in agustincarmona/laravel-api-schema
Package laravel-api-schema
Short Description Publish schema, for each public method of API controllers
License MIT
Informations about the package laravel-api-schema
Publica el schema de entrada y salida de tu api
Los que habéis usado servicios web de ASP.NET o Java estaréis familiarizados con el formato WSDL. El objetivo de este formato es devolver la estructura de datos de entrada y datos de salida para cada método del API. Esto es un útil porque te permite montar objetos o clases dinámicamente a partir del schema de un servicio web.
Pues bien, imaginar que estamos usando un API y queremos montar unos objetos para encapsular la respuesta del servicio web y trabajar esos datos. Nos tocaría hacer una transformación de esos datos en nuestra estructura de clases.
Ahora imaginar que podéis construir los modelos dinámicamente sólo consultando el schema del servicio web, esto nos ahorraría tener que buscar la documentación para ver la nueva estructura, implementar las nuevas propiedades en nuestros modelos y adaptar nuestra aplicación.
Instalación
Cómo se usa
Añadir el trait APISchema\Http\Traits\SchemeTraitController en tú controlador.
Crear una clase con los parámetros de entrada de cada acción del controlador.
En cada acción del controlador añadir un comentario para definir la clase que contiene la definición de los datos de entrada del método.