XHP library 3.2.0

XHP is Facebooks extension to utilize XML fragments and structures directly within PHP source code. Which allows simpler document construction, processing, and sane variable interpolation without having to use DOM functions. It also permits to declare custom :xml:object classes for even quicker templating. Previous versions are available for Zend/PHP5.

Tags php hhvm c hack xml language-syntax extension developers
License MITL
State stable

Recent Releases

3.2.022 May 2020 13:25 minor feature: Permits either type-assert v3 or v4. Requires HHVM 4.32 or above; older versions of HHVM are themselves unsupported.
3.1.120 Feb 2020 14:05 minor feature: Child validation: support `x:composable-element`, not just `x:element` ( #217). This makes it possible to use these traits for HTML tags etc. Test plan: ``. fredemmott@fredemmott-mm1 xhp-lib /code/hhast/bin/hhast-migrate --add-xhp-children-declaration-method src. fredemmott@fredemmott-mm1 xhp-lib hh_client. No errors!. fredemmott@fredemmott-mm1 xhp-lib vendor/bin/hacktest tests. ...............................................................................S.SSS.S.S.....................SSSS......SS. Summary: 125 test(s), 113 passed, 0 failed, 12 skipped, 0 error(s). fredemmott@fredemmott-mm1 xhp-lib git diff src gist -t patch. https://gist.github.com/6dafcf73169756cc80078d2e765ada2c. ``. Tests fail without this change. That is with hhvm/hhast#268.
3.1.013 Feb 2020 10:45 minor feature: XHPChildDeclarationConsistencyValidation: requires that the element have consistent old- and new- style child declarations. XHPChildValidation: uses new-style validation, and requires that the element does not have an old-style declaration.
3.0.124 Nov 2019 11:25 minor feature: HH_ME a typechecker error introduced in the last nightly . Update projects readme. . Upgrade tests to strict equality. . Ignore vendor/bin.
3.0.019 Nov 2019 10:05 minor feature: Add parser-cache files to.gitignore . Support `disallow_array_literal`. . Bump hacktest dependency to 2.0. . Find `Stringish` replace `string` in src/tags.
2.10.016 Jul 2019 07:05 minor feature: Require HHVM 4.13+ Supporting 4.14 requires replacing instanceof with is; 4.13 contains. Performance improvements to `is` expressions making this change. Practical outside of repo-authoritative mode.
2.9.525 Jun 2019 06:45 minor feature: Stop committing composer.lock . Remove usages of lval as an expression. . Support HHVM 4.10.
2.7.028 Aug 2018 11:25 minor feature: Supports HHVM 3.28. Adds attribute to support the Subresource Integrity spec. Adds support for XHPUnsafeRenderable in HTML attributes.
2.6.011 May 2018 14:05 minor feature: is available under the MIT license. Adds support for the XHP spread operator (available in HHVM 3.24+).
2.5.110 Feb 2018 14:25 minor feature: Safe_array=true and safe_vector_array=true. Enable_experimental_tc_features=no_fallback_in_namespaces (nightlies, expected in 3.25).
2.5.009 Jan 2018 16:05 minor feature: test with experimental shape options . update dependencies. . test against HHVM nightly builds. . make AttributesTest strict instead of decl. . change tested shape behavior depending on HHVM_VERSION_ID. . Update composer.lock. . Add 'as' attribute to link tag. . Add mention of hhvm-autoload requirement. . Type checking with 'safe_array = true'. . Support HHVM 3.24, require HHVM 3.23. . Add string cast for 3.24 in tests.
2.4.030 Sep 2017 14:05 minor feature: this release uses TypeAssert v3 instead of v2, allowing it to be used in new projects. this release splits the API for enabling/disabling validation into separate options for child validation and attribute validation. :xhp:: ENABLE_VALIDATION no longer exists. attribute validation is off by default; we aim to remove it completely from a future release. This will allow removing the dependency on TypeAssert in the future. The runtime validation isn't as useful now given that the typechecker validates attributes specified when instantiating XHP objects. The runtime validation is bad for performance. Keeping the runtime validation in sync with the typechecker has been a frequent source of.
2.2.413 Feb 2016 03:16 minor feature: Remove bogus assert Unneeded. Typechecker and tests happy. Needed for 3.12 as assert.active default has changed.
2.2.323 Dec 2015 03:16 minor feature: callable is undefined in Hack: 60a4141 . Update 91carriage/phpunit-hhi to versions that support assume_php-false (only affects --dev): 6788a34 . Exclude tests/ from release tarballs, including packagist installs of release versions: 7e9599a.
2.2.215 Jul 2015 16:05 minor feature: Add :picture. Allow arbitrary values for :input autocomplete attribute. Support num and arraykey attributes. Add minimum version of HHVM (3.6.0) to composer.json.
2.2.130 Jun 2015 03:25 minor feature: if an attribute is specified as callable, raise an exception that states it's unsupported in XHP-Lib =2.0 instead of the generic 'unknown attribute type' error. Support non-numeric values for :input min/max eg date or time.
2.0.117 Apr 2015 10:25 minor bugfix: Make second argument to getContext() optional. Improve performance of AwaitableXHP. Add 'init.php' for people who choose not to use Composer. Small changes to make it pass the typechecker in the upcoming HHVM 3.7. Updated patent grant (https://code.facebook.com/posts/1639473982937255/updating-our-open-source-patent-grant/).
2.0.007 Apr 2015 10:25 major feature: Convert to Hack. The 1.x release series is still supported for users of PHP5. Added AwaitableXHP ; this allows you to build efficient XHP components where data fetching requirements are an implementation detail instead of part of the API they present. Attribute coercion is now much stricter, and raises an E_DEPRECATED. In a future release, the Hack typechecker will consider any coercion to be an error, and XHP-Lib will throw an exception. Added XHPUnsafeRenderable and XHPAlwaysValidChild interfaces, making it easier to include markup from other sources in an XHP tree. See MIGRATING.md for more information. Split out getID() , addClass() , transferAttributes() and friends from :x:html-element to a new XHPHelpers trait, which implements the new HasXHPHelpers interface. Add new XHPRoot interface, implemented by :x:primitive and :x:composable-element . This is the return type of render(). Removed Callable attribute type, as this is not supported by Hack. Functions that dealt with arrays (eg getAttributes() ) now use Vector, Map, or Set. Added reflection; ReflectionXHPClass is the main entry point.