omatech / editora-laravel-connector-dbinterface
Package info
github.com/omatech/editora-laravel-connector-dbinterface
pkg:composer/omatech/editora-laravel-connector-dbinterface
Requires
- omatech/editora-dbinterface: ^1.8.0
Requires (Dev)
None
Suggests
- aws/aws-sdk-php: Required by Media\PublicMediaController to serve media from a private S3 bucket
Provides
None
Conflicts
None
Replaces
None
- dev-master
- v3.11.0
- v3.10.0
- v3.9.0
- v3.8.0
- v3.7.0
- v3.6.0
- v3.5.2
- v3.5.1
- v3.5.0
- v3.4.0
- v3.3
- v3.2.1
- v3.2
- v3.1.1
- v3.1.0
- v3.0.3
- v3.0.2
- v3.0.1
- v3.0
- v2.2.1
- v2.2.0
- v2.1.0
- v2.0.16
- v2.0.15
- v2.0.14
- v2.0.13
- v2.0.12
- v2.0.11
- v2.0.10
- v2.0.9
- v2.0.8
- v2.0.7
- v2.0.6
- v2.0.5
- v2.0.4
- v2.0.3
- v2.0.2
- v2.0.1
- v2.0.0
- v1.0.4
- v1.0.3
- v1.0.2
- v1.0.1
- v1.0
- dev-compatibility-functions-new-laravel
- dev-compatibility-laravel-11
- dev-new-date-filter
- dev-develop
This package is auto-updated.
Last update: 2026-10-28 21:22:06 UTC
README
Laravel Setup
Create the new laravel empty project
composer create-project --prefer-dist laravel/laravel editora-test
Setup you .env file with database connection and so on
In the composer.json file add the stability settings in the root of the file and change the name and the description of the project, for example:
"name": "editora-test",
"description": "Editora Frontend",
"minimum-stability": "dev",
"prefer-stable": true,
Do a composer update
composer update
Publish the new vendor, run:
php artisan vendor:publish --provider=Omatech\Editora\Connector\ConnectorServiceProvider
Put all your markup assets in resources/assets/markup (scss, js, img, fonts,...)
Overwrite the mix.js call in webpack.mix.js in root folder for this one
mix.js('resources/assets/js/app.js', 'public/js')
.sass('resources/assets/markup/scss/styles.scss', 'public/css/styles.css')
.copy('resources/assets/markup/js', 'public/js')
.copy('resources/assets/markup/img', 'public/img')
.copy('resources/assets/markup/fonts', 'public/fonts')
.version();
Install and run npm
npm install
npm run dev
Add editora routes in routes/web.php
use Omatech\Editora\Connector\Editora;
Editora::routes();
In config folder there're the two files needed for editora setup editora.php sets the language and different editora options editoradatabase.php sets the editora structure
Modify editoradatabase.php and apply changes running
php artisan editora:create
Check if editoradatabase is changed
php artisan editora:databasechanged
Generate fake content for editora
php artisan editora:fakecontent --delete_previous_data
Create the MVC structure for the current Editora Structure
php artisan editora:createmvc
Clone the editora_admin in another folder, for example editora-test-admin
cd .. (to your www root folder)
mkdir editora-test-admin
cd editora-test-admin
git clone https://aponsoma@bitbucket.org/omatechteam/editora_admin.git .
Copy the config and change the database and folders and urls settings in ompinfo.php (look for # characters to see what to change)
cd conf
cp ompinfo_sample.php ompinfo.php
Double check the HASHED_PASSWORDS, must be 1
Change your virtual hosts to include the admin directory and restart Apache, for example
<VirtualHost *:80>
DocumentRoot "/var/www/editora-test/public"
ServerName editoratest.localhost
<Directory "/var/www/editora-test/public">
Allow from all
Require all granted
AllowOverride All
</Directory>
Alias /admin "/var/www/editora-test-admin"
<Directory "/var/www/editora-test-admin">
AllowOverride All
Allow from all
Require all granted
</Directory>
</VirtualHost>
Laravel Commands
Generator
Creates the Editora database structure following the rules set in config/editoradatabase.php
php artisan editora:create
Fake Content
Creates random content for the Editora database.
php artisan editora:fakecontent
Arguments
php artisan editora:fakecontent --exclude_classes=1,10,11,12,13
{--num_instances=} {--include_classes=} {--exclude_classes=} {--pictures_theme=} {—debug} {--delete_previous_data}
--num_instances number of instance to create for each class
--include_classes generate only this class_ids, comma separated
--exclude_classes generate all but this class_ids, comma separated
--pictures_theme generate pictures themed with that word, default:cats you can use abstract, animals, business, cats, city, food, nightlife, fashion, people, nature, sports, technics, transport
--debug show all sqls (if not present false)
--delete_previous_data **USE WITH CAUTION**, if set deletes all the previous data before generating the fake data
TBD Falta añadir contenido aleatorio para algunos atributos (mapas, date,...).
CreateMVC
Create the Model, View and Controller files for the Frontend (if they don't exists)
php artisan editora:createmvc
--include_classes generate only this class_ids, comma separated
--exclude_classes generate all but this class_ids, comma separated
--old_school_controllers allow generation of old_school_controllers instead of new ones
Arguments
--include_classes=1,2,3 generate only this class_ids, comma separated
--force_overwrite_views
--force_overwrite_models
--force_overwrite_controllers
--force_overwrite_all
TBD Falta crear argumento de force para borrar si o si las clases.
Modernize
Improves database structure of the editora database, use only in old editoras, not new projects. It creates indexes, new columns added recently like batch_id, external_id and changes to use encrypted passwords
php artisan editora:modernize
Caching and private media
Optional building blocks, all off until the application registers them. The provider merges their defaults as editora-cache and editora-media; an application config/editora-cache.php or config/editora-media.php replaces each top-level key it defines.
Content cache
Cache\CachedExtractor caches the complete graph returned by the listed extractor methods. An entry is fresh for CMS_CACHE_TTL seconds (60) and, up to CMS_CACHE_STALE_TTL (86400, a day), is served at once and refreshed after the response. Nested calls, preview, debug and avoid_cache always read the database. Register it in a service provider's boot():
\Omatech\Editora\Connector\Cache\CachedExtractor::register($this->app, ['findInstanceByIdAllElements', 'findChildrenInstances']);
Leave out methods whose arguments come from free text, such as a search building findInstancesInList ids: every distinct query would become a cache entry. Cache\CachedStaticTexts::register($this->app) does the same for static texts, once per language.
CMS_CACHE_STORE selects the store (default: the application's), CMS_CACHE_ENABLED=false turns it off and changing CMS_CACHE_VERSION stops serving every older copy. To discard everything on publication instead, bind Cache\CacheVersion to your own implementation.
Publications
When the Editora admin runs inside the application, Cache\ContentFreshness::register($this->app) (in register(), before CachedExtractor::register) makes publications reach visitors without a cold render. Every write the admin makes to public CMS tables records a publication time in the content store; sign-in, favourites, recent items, roles and permissions do not count, nor do writes from visitor requests or console commands. Content read from the database before that time is no longer fresh: it is served once more, at once, and refreshed after the response. With CMS_CACHE_PUBLICATIONS=reload (or 'publications' => 'reload' in the application's config/editora-cache.php) it is read again before it is served instead: the first visit after a publication already shows it, at the cost of reading that page's content from the database. editors does that only for browsers with an Editora admin session (marked by PageCache, below): the editor sees a save on the first visit and that read brings the content up to date for everyone, while a visitor who arrives first gets the previous copy once and never waits. All admin writes go through the Laravel connection, so saves, publication, deletion, cloning, relations, ordering, static texts, images and imports are all seen.
Static texts cached by Cache\CachedStaticTexts follow the same rule. When the admin runs elsewhere and notifies the application, as Aptima's integration channel does, bind ContentFreshness with the content store instead and call published() on each notification; it throws when the publication cannot be recorded, so the notification can fail visibly.
Page cache
Cache\PageCache is a global middleware that serves /{language} and /{language}/{slug} to every visitor from one copy per cache version, for PAGE_CACHE_TTL seconds (3600, an hour). The key includes the build (the time the configuration was cached), so every deploy starts afresh, and the last publication, and a page rendered from content that was not fresh is answered as STALE and not stored, so a page shows a publication as soon as its content has refreshed. It only stores a page that another visitor may receive: a complete 200 text/html document of at most 512 KiB, without the session's CSRF token, _token fields, a csrf-token meta, a nonce or a VarDumper dump, rendered for a session holding only language and navigation, and adding no header or cookie besides the session ones. Answers carry X-Page-Cache: HIT|MISS|STALE|BYPASS and Cache-Control: no-store, so an edge cache never keeps a page the version no longer reaches. At most 32 MiB of new pages are stored per TTL window, so at most two windows' worth is alive. Register it after any middleware whose headers every response needs:
protected $middleware = [ // ... \App\Http\Middleware\SecurityHeaders::class, \Omatech\Editora\Connector\Cache\PageCache::class, ];
Editora admin sessions never get or leave the shared copy, because their pages carry the edit tools (@editora_scripts). The session is only known after the application has run, so every response to a session with a role sets the editora_editor cookie (renewed like the session, removed once the role is gone), and requests carrying it skip the cache.
PAGE_CACHE_STORE selects the store and PAGE_CACHE_ENABLED=false turns it off.
Media from a private bucket
Media\PublicMediaController serves CMS media from a private S3 bucket under the site's own URL, so the bucket host never reaches the browser:
Route::get('uploads/{path}', \Omatech\Editora\Connector\Media\PublicMediaController::class)->where('path', '.*');
It reads editora-media.prefix + path from the editora-media.disk filesystem disk, which must be a complete s3 disk with an HTTPS endpoint; otherwise it answers 404 and the web server serves local media. It needs aws/aws-sdk-php, not the Flysystem S3 adapter. Responses are streamed with Cache-Control: public, max-age=86400 (cache_seconds), ETag, Last-Modified, 304 answers and a single forwarded bytes= range. The content type comes from editora-media.types, never from stored metadata; every answer carries nosniff and SVG adds a sandbox CSP. Other extensions answer 404, or download as attachments with attachments => true. Hidden paths, traversal, backslashes, denied_prefixes and denied_extensions answer 404 without reaching storage; a missing object answers 404 and a storage failure 502 without caching, and is reported.