teelevision / redaxo5-laravel
The Laravel Framework as Redaxo5 AddOn.
Installs: 5
Dependents: 0
Suggesters: 0
Security: 0
Stars: 5
Watchers: 1
Forks: 24 557
Open Issues: 0
Type:project
pkg:composer/teelevision/redaxo5-laravel
Requires
- php: >=7.0.0
- ext-json: *
- fideloper/proxy: ~3.3
- laravel/framework: 5.5.*
- laravel/tinker: ~1.0
Requires (Dev)
- filp/whoops: ~2.0
- fzaninotto/faker: ~1.4
- mockery/mockery: ~1.0
- phpunit/phpunit: ~6.0
- symfony/thanks: ^1.0
This package is auto-updated.
Last update: 2025-10-29 02:29:54 UTC
README
teelevision/redaxo5-laravel is a port of the Laravel framework that runs as an add-on in Redaxo5. It aims at enabling you to write Redaxo5 add-ons the way you would write a Laravel application.
Documentation
This documentation only covers the differences to the Laravel documentation. Any topic not mentioned below should in theory work as described in the Laravel documentation. In practice many features are yet untested.
Installation
In addition to the Server Requirements you will need a running instance of Redaxo version 5.0 or greater.
Inside your Redaxo installation go to /redaxo/src/addons and run the following to install:
composer create-project teelevision/redaxo5-laravel my_laravel_addon "5.7.*"
You do not need to configure your web server. I mean, there is no way to, you have to get a web server running Redaxo, not the add-on. You can use pretty URLs in the frontend using YRewrite, I suppose. In the backend pretty URLs are not be supported.
You should still configure your .env file, especially creating an application key.
Like every other add-on you have to install it in the Redaxo backend in order to use it.
Make sure that the root directory of your add-on is writable, as well as the storage directory, its sub-directories, and the bootstrap/cache directory.
Directory Structure and Request Lifecycle
- The
assetsdirectory is the Redaxo add-onassetsdirectory. Any files placed here are copied to a public directory when installing the add-on. - The
configdirectory does not contain thecachedirectory which instead is moved to Redaxo's cache. - The
libdirectory is used by add-ons to provide code that Redaxo scans and auto-loads. So this is directory needs to be used for classes and functions that should be available in the frontend (Redaxo modules) or to other add-ons. - The
pagesdirectory- Contains some files for booting laravel in the backend and frontend.
- The entry point for all requests to the add-on are the files
pages/index.phpandpages/frontend.phpinstead ofpublic/index.php. But those files do not really qualify as entry points. They are more like the interface between the add-on and Redaxo or other add-ons. Redaxo callspages/index.phpautomatically for any backend add-on page.
- The
publicdirectory does not exist. The functionality lies within theassetsandpagesdirectories. - The
storagedirectory- The compiled Blade templates and the framework cache are stored in Redaxo's cache rather than this directory.
- The
vendordirectory is renamedvendor-composerbecause otherwise Redaxo tries to index all the files in there which could take minutes. - The
package.ymlfile describes your add-on and is required by Redaxo. - The
app/Redaxodirectory contains models for redaxo database tables like users. This does not yet contain all models and each model could be incomplete.
Routing
- A route's uri is matched against the
pagequery parameter instead of the path of the uri. For example the routemy_laravel_addon/welcomematchespage=my_laravel_addon/welcomewhich is how Redaxo knows where to route a request in the backend. This requires you to begin your route's uri with the name of your add-on. However you can define frontend routes that do not have this limitation. Frontend routes can be called usingMyLaravelAddOn::frontend('route_uri')from Redaxo modules in the frontend or basically from everywhere outside your add-on. - You have to describe all your routes in your
package.ymlso that Redaxo knows that it should call your add-on. - Route parameters are not supported since all routes have to be pre-defined in the
package.ymlwhich does not support it. The query parameters exceptpageare used as route parameters instead for callback/controller arguments. This is untested if there are multiple parameters since the order might not be defined which would lead to problems. So only use one parameter to be sure. Also there is no equivalent for a required parameter, which requires you to check each argument yourself. It could be possible to write a route validator using the route's wheres to achieve this.
HTTP Responses
- When returning a JSON response on a frontend route the content of the response is returned to the caller of
MyLaravelAddOn::frontend($uri). Otherwisenullis returned.
Views
- Redaxo embeds the output of your add-on in the HTML that Redaxo generates in the backend and frontend. Therefore your views don't need to generate HTML headers and the sort.
URL Generation
- You can generate urls using
action()androute()helpers for backend routes only. This is because for frontend routes it is not generally possible to tell from which single url a frontend route will be called. Frontend routes can be called from anywhere outside your add-on. - Don't use the
url()helper to generate urls, instead use therex_urlclass andrex_getUrlfunction provided by Redaxo.
Pagination
- Per default any pagination uses the
pagequery parameter which is used by Redaxo in the backend for routing requests. Therefore you have to explicitly change the pagination page parameter like for example:->paginate(15, ['*'], 'p').
Motivation
Redaxo provides very little for add-ons compared to the huge frameworks like Laravel. While this works for small add-ons it hardly satisfies my developer needs when creating something bigger. During one project I saw myself using more and more of the illuminate/* packages that I love so much, that I decided to try booting the whole framework. I don't want to take a stand on whether this is a good idea, I just want to share this solution that helped me finish that one project.
License
The Laravel framework is licensed as stated on their page.
All changes to the Laravel framework in this repository are open-sourced software licensed under the MIT license.