Download the PHP package dartanian300/xmodule-php without Composer
On this page you can find all versions of the php package dartanian300/xmodule-php. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download dartanian300/xmodule-php
More information about dartanian300/xmodule-php
Files in dartanian300/xmodule-php
Package xmodule-php
Short Description A PHP implementation of Modo Lab's Xmodule specification
License MIT
Informations about the package xmodule-php
Xmodule-PHP
A PHP library for implementing Modo Lab's XModule web service.
This library follows the XModule v1.0 specification as much as possible. Unless otherwise stated, each element can be instantiated via a camel-case version of their name (from the specification). For easiest use, reference the specification while using this library (while keeping in mind the "Things to remember" below).
To Install:
Be sure to include Composer's autoloader
Use the elements together to create your XModule response:
Few things to remember:
- All elements will check for required fields when
json_encode()
is called. If there's a missing field, an exception will be thrown. - String fields with predefined values are set using the value as a function (ex - setting
actionType
to 'constructive':$linkBbutton->actionType->constructive()
) - Freeform string fields accessed via
set()
&get()
- Boolean fields accessed via
get()
,true()
&false()
- Array fields are generally accessed via
add()
,get()
,delete()
(if multiple arrays, append camel-case attribute name. See "Using elements with multiple array fields" example below) elementType
&inputType
fields are automatically set
Get Started Examples
Access/Set predefined string fields
Access/Set freeform string fields
Access/Set boolean fields
Access/Set/Delete array fields
Access/Set/Delete object fields
Access/Set id field
Note: ids can only be set on elements that support it
Access elementType field
More Examples
Using elements with multiple array fields
Using forms
Using MultiColumn
A few exceptions
Some fields/elements use a modified add()
method. See their signatures below:
ProgressiveDisclosureItems
andQueryParameters
fields:add($key, $element)
.MultiColumn
elements:add($columnNum, $element)
.
More Documentation
More documentation can be found by navigating to the docs
folder in a browser after running the following command:
Note: Assumes that PHPDoc is installed in the project's 'vendor' folder and that you are executing on a Unix-based system. Command might need to be modified to work on Windows systems (located in
composer.json
).
Element Reference
Available Top-Level Elements:
- Root Element: XModuleResponse
- AutoUpdateAccessibility
- ButtonContainer
- Carousel
- Collapsible
- Container
- Detail
- GoogleMap
- Grid
- Heading
- HTML
- Image
- Link
- LinkButton
- LoadingIndicator
- MultiColumn
- Portlet
- Table
- Tabs
- Toolbar
- ToolbarContent
- XList (renamed from specification's List since that's a reserved word in PHP)
Available Form Elements:
- Root Element: Form
- Checkbox
- FormButton
- HiddenField
- Label
- Password
- Phone
- RadioButtons
- SelectMenu
- TextArea
- TextInput
- Upload
Available GoogleMaps Elements (namespace: XModule\GoogleMaps):
- MapPoint
- MapPolygon
- MapPolyline
- Point
(namespace: XModule\GoogleMaps\MapPoint)
- Anchor
- Icon
- Size
Available Toolbar Elements (namespace: XModule\Toolbar):
- MenuItem
- ToolbarButton
- ToolbarLabel
- ToolbarMenu
Available Helper Elements (namespace: XModule\Helpers)
For use with Table
- ColumnOption
- Row
- Cell
For use with Carousel
- CarouselItem
For use with Grid
- GridItem
For use with XList
- ListItem
For use with Tabs
- Tab
Concepts Not Currently Implemented
- DynamicPlacemarks field (in
GoogleMap
) - XComponents