• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Settings Management Library

#1
Hi all! I'd like to share my final CodeIgniter 3 library, fully rewritten for CI4 and ready to use. As with all my libraries, it's "configuration lite" so read the docs at GitHub, plug it in, and go.

Tatter/Settings - plug-and-play settings management for CodeIgniter 4

Basic usage:
1. Install with Composer: `> composer require tatter/settings`

2. Update the database: `> php spark migrate:latest -all`
3. Add settings: `> php spark settings:add timezone user America/New_York`
4. Load the service: `$settings = service('settings');`
5. Get/set settings per user:
PHP Code:
$settings->timezone $_POST['timezone_preference'];
...
$userTimezone $settings->timezone

Once the library is included all the resources are ready to go and you are ready to start adding settings. You may import setting templates directly into the `settings` table or add them manually with the provided CLI command: `> php spark settings:add`

Settings take one of three scopes: session, user, global.
  • Global settings are the same for every user and provide a dynamic way to set application-wide values
  • User settings start with a default template value but each user may make their own default that persists across sessions
  • Session settings start with a default template value and may be changed by a user but revert for each new session

In addition to the five libraries I have ported (and the original 'Audits') I have two CI3 libraries I never completed: 'Notices' (a user communication gateway) and 'Plots' (a sitemap generator and route analyzer). Please let me know if you'd find interest in these for CI4.
As always I am eager for feedback, suggestions, and contributions - feel free to respond here or on GitHub (https://github.com/tattersoftware/codeigniter4-settings). Thanks for reading!

Thanks for reading!
Reply

#2
Hey MGatner!

Great work!

I'd recommend adding some tests to your libraries though. Many people will hesitate to add untested code to their application.
Codeigniter is simply one of the tools you need to learn to be a successful developer. Always add more tools to your coding arsenal!
Reply

#3
Thanks for the feedback and suggestion! I’ve never used PHPUnit but with its core involvement in CI4 testing it’s been on my list. I’ll dive in and plan to add the to my libraries. I’m open to any pointers, resources, ideas if you have them!
Reply

#4
I'm a big fan of codeception which is built on top of PHP unit. You should take a look as well.
Codeigniter is simply one of the tools you need to learn to be a successful developer. Always add more tools to your coding arsenal!
Reply

#5
Thanks! I’ll take a look.
Reply

#6
@MGatner you might want to take a look at this and follow these practices when releasing a new package

https://github.com/thephpleague/skeleton
Codeigniter is simply one of the tools you need to learn to be a successful developer. Always add more tools to your coding arsenal!
Reply

#7
Thanks! I’ll take a look. I love The League’s stuff.
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


Users browsing this thread:
1 Guest(s)


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.