Download the PHP package moox/core without Composer
On this page you can find all versions of the php package moox/core. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Package core
Short Description The Moox Core package cares for many common features. It is required by all Moox packages.
License MIT
Homepage https://moox.org/
Informations about the package core
Moox Core
The Moox Core package cares for many common features. It is required by all Moox packages including Moox Builder. If you want to use Moox Builder to generate a Custom Package, check out the features you're already able to use, if you want to Moox Core independently in your app or a package, you need to use the traits accordingly.
Installation
If you want to install Moox Core (normally not necessary, because this package is required by all other Moox packages), you can:
Requires
Moox Core requires these packages:
- https://filamentphp.com/ and https://laravel.com/ usually in the latest stable version, see composer.json
- https://github.com/Pharaonic/laravel-readable - for formatting numbers and dates to be human readable
- https://github.com/ryangjchandler/filament-progress-column - to use progress bars in Filament tables
- https://github.com/codeat3/blade-google-material-design-icons - we use Google Material Design Icons
Traits
Dynamic Tabs
Moox allows you to change (or remove) the Filter tabs for Filament Resources. The HasDynamicTabs Trait is used in all of our packages including Moox Builder.
Disable Tabs
If you want to disable tabs for this resource, just do a
Basic Tabs
A pretty basic example:
Visibility
The visible
-option is not necessary, as it defaults to true. But if you want to toggle the visibility of a Tab, you can use a Closure like this:
Translation
See Translations in Config on how to use the trans feature.
Queries
See Queries in Config on how to use the query feature.
Custom implementation
As mentioned, the DynamicTabs trait is already implemented in all Moox packages including Moox Builder. If you want to implement this feature from outside Moox, please have a look at one of our Filament resources list pages:
and the config of the package:
on how to implement the feature in your custom package.
Queries in Config
Dynamic Tabs uses the QueriesInConfig Trait, that means you can build queries like this:
The simplest query is for the All tab, of course:
All other queries require three parameters:
Add more, if you need:
We DON'T YET support relations nor the like operator. If you're in the need, we would be happy to merge a PR :-)
The value of a query accepts a closure. Following example is perfect for a "My Tab" as it filters for the current user:
Finally, a special idea and therefor NOT YET implemented: if the value contains a class and a forth parameter hide-if-not-exists
set to true, Moox will check, if the class exists and otherwise hide the tab. That allows us to register buttons for packages, that are not necessarily required.
An practical example (works for Sessions, Devices and other user-related entities):
And finally the most-known mistake, throws "Cannot access offset of type string on string":
So don't forget to put the query in an extra array, even if it is a single query.
As mentioned, the QueriesInConfig trait is used in HasDynamicTabs, another Trait in Moox Core. Please code dive there, to see how to implement the Feature from outside Moox.
Translations in Config
A simple but useful feature is the TranslationsInConfig Trait that is used a lot in our config files, as seen with Tabs:
Translations of our packages are generally organized in Moox Core. Only few of our packages ship with own translation files. These packages are registered in the core.php configuration file. If you develop a custom package (preferably using Moox Builder) you need to add your custom package to the Package Registration.
Translations in Config are used in the CoreServiceProvider like this:
Request in Model
The RequestInModel Trait is currently used by all Moox Press packages. It allows us to use the request data in some of our models. You can code dive into Moox\Press\Models\WpTerm.php, to find more code examples. The basic implementation looks like this:
Google Material Design Icons
As Google Material Design Icons provides one of the largest sets of high quality icons, we decided to use them as default for Moox. The GoogleIcons Trait changes the default Filament Icons, too. It is used in the CoreServiceProvider like this:
You can disable Google Icons and use the Filament default icons instead, see config.
Log Level
Log Level is a useful feature to debug things in Moox, even when you're in production, or get your logs silent while developing.
You can adjust the log level and whether to log in production in Moox Core's Config.
Services
DNS Lookup
The DnsLookupService does just a - you guessed it - DNS Lookup. That Service is currently used in Moox Sync's PlatformResource like so:
APIs
Core API
The Core API api/core
provides all available packages (and their configuration).
It is currently not used, and may be changed or removed.
Models API
The Models API api/models
provides all available and loaded models. It is used by Moox Sync, for example.
The Models API is work in progress. It probably will be secured.
Shared Hosting API
The Shared Hosting API schedule/run
is used to run scheduled tasks in shared hosting environments.
https://yourdomain.com/schedule/run?token=secure
If you want to use the Shared Hosting API, you need to set the SHARED_HOSTING_ENABLED
config to true
and the SHARED_HOSTING_TOKEN
config to a secure token.
Config
Package Registration
Moox has a simple package registration. To ensure that some features of Moox Core are only available for known packages, all Moox packages and all custom packages, created with Moox Builder, need to register here:
You can publish the Moox Core configuration file and add own packages:
but remember to update the Array regularly then, to allow newer Moox packages to work flawlessly.
Disable Google Icons
You can disable Google Icons, and use the Filament default iconset (Heroicons) instead.
This disables the replacement of the Filament core icons, done in Core, as well as the individual icons of most of our packages. Some packages will remain with Google Icons, because there is no corresponding icon in the Heroicon set.
Logging
You can adjust the log level and whether to log in production. Currently used by Moox Sync and soon by other Moox packages, too.
Shared Hosting
You can enable shared hosting features. This is useful if you want to run scheduled tasks in shared hosting environments. It allows you to run the queue:work
and 'schedule:run' command from an URL
Assets
Moox Core provides a couple of (non-publishable) assets, loaded by a dynamic route. All images and assets in /public can be used like url('/moox/core/assets/noimage.svg'
.
Changelog
Please see CHANGELOG for more information on what has changed recently.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
- All Contributors
License
The MIT License (MIT). Please see License File for more information.
All versions of core with dependencies
adrolli/filament-title-with-slug Version *
spatie/laravel-package-tools Version ^1.13.0
laravel/framework Version ^10.0|^11.0
filament/filament Version ^3.2
pharaonic/laravel-readable Version ^1.0.5
codeat3/blade-google-material-design-icons Version ^1.0
ryangjchandler/filament-progress-column Version ^1.0
spatie/laravel-sluggable Version ^3.6