Use Composer to install the Codex library:
composer require wikimedia/codex
The Codex library provides a variety of components to build UI:
Here is a basic example of how to use the Codex library:
<?php require 'vendor/autoload.php'; use Wikimedia\Codex\Utility\Codex; $codex = new Codex(); $accordion = $codex ->accordion() ->setTitle( "Accordion Example" ) ->setDescription( "This is an example of an accordion." ) ->setContentHtml( $codex ->htmlSnippet() ->setContent( "<p>This is the content.</p>" ) ->build() ) ->setOpen( false ) ->setAttributes( [ "class" => "foo", "bar" => "baz", ] ) ->build() ->getHtml(); echo $accordion; ?>
The following scripts are defined for testing and code fixing purposes:
test
: Run linting and code checks.fix
: Automatically fix code style issues.phan
: Run the Phan static analyzer.phpcs
: Run the PHP Code Sniffer.start-sandbox
: Start the sandbox environment for testing.Example usage:
composer run-script test composer run-script fix composer run-script phan composer run-script phpcs composer run-script start-sandbox
This project is licensed under the GPL-2.0-or-later. See the LICENSE file for details.
Please read the CONTRIBUTING file for details on our code of conduct, and the process for submitting pull requests to us.
Report bugs at Phabricator.
For more information, visit the homepage.