Download the PHP package velosipedist/beatrix without Composer
On this page you can find all versions of the php package velosipedist/beatrix. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download velosipedist/beatrix
More information about velosipedist/beatrix
Files in velosipedist/beatrix
Informations about the package beatrix
Beatrix
Attempt to beat the Bitrix defectiveness. You should not know what is inside.
What i have to do?
Just download beatrix.phar
from releases Github section or build it by yourself using Phing
Include beatrix.phar
at Bitrix startup (recommended in /bitrix/php_interface/init.php, create if not exists).
Initialize with options if you need to tune up something:
Some options will be forced internally, others available as described in Slim docs
Nothing changed. What's next?
Of course. There is no magic (almost), you have to write some code yourself :unamused:.
All Beatrix instance methods available through Beatrix::app()
(it gives us access to Application which is Slim app with some improvements), but also we have some useful shortcut functions.
For now we have following features:
Plates templating engine
Old school template-sawing (with header.php & footer.php as output) replaced with power of Plates engine. It gives us templates inheritance, blocks, etc.
Basic setup
Just create .tpl folder at site document root (or configure any other using options). Now you can place any php templates here and render them individually:
Non-sawed layout can be used this way:
-
open template's header.php and write only this
- at template's footer.php write:
After this, Beatrix will search .tpl/layout/{templateName}
as layout template.
But you can change layout at runtime from anywhere, just calling:
! Any layout template MUST contain
$this->section('content')
call !
Sections
Inside of any particular template you can create or rewrite existing named section to print at layout later:
If contents is string it will be written as section output, that can be overwritten later if you want.
If contents is callback, it will be executed at section rendering moment inside of layout template. It is useful when some heavy rendering logic may become useless for some reason later, and this section will be omitted without overhead.
Slim instance running
Beatrix uses Slim app instance with some tunings under the hood, to keep all settings, common container features and fields.
We also have all routing power of Slim. It allows to handle any non-static site part with no more /urlrewrite.php!
Put .htaccess
in desired site subdirectory, i.e. /company/news
:
Then inside index.php (leave Bitrix file header & footer)
All routing features (get/post/etc, grouping, regexp in conditions) available in docs.
Database and infoblocks
See readme for iblocks (src/iblock/README.md) for details
Helper functions
is_ajax()
does current http request sent by AJAX. Useful in Bitrix templates conditions
(set in PHP condition of empty template, to render "plain" app response).
slimUrl()
url to named route with path params + query params appending support
And finally, all Illuminate/Support sweet helpers (array_pluck
, str_finish
etc).
RSS builder bundled
Instead of generic component you can emit RSS data using this library
Is it all for now?
Yes, for now, but in perspective or alpha development:
- automatic menu builders, by stucture, Infoblock hierarchy and mixed
- email sending
- some console tools for routine tasks
Also, some subsplit modules (not spooky Bitrix modules!) in draft:
- RegionManager
- Faq sending
- «Call me back» form
All versions of beatrix with dependencies
slim/slim Version 2.*
illuminate/support Version 4.1.*
symfony/console Version 2.7.*
league/plates Version 3.*
league/url Version 3.*
symfony/finder Version 2.*
intervention/image Version 2.2.*
siriusphp/validation Version 2.1.*
suin/php-rss-writer Version 1.*