PHPackages                             damodar-bhattarai/settings - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. damodar-bhattarai/settings

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

damodar-bhattarai/settings
==========================

Package to store and get general website settings on the fly.

1.1.3(11mo ago)312.2k↓50%1MITPHP

Since Nov 12Pushed 11mo ago1 watchersCompare

[ Source](https://github.com/damodar-bhattarai/settings)[ Packagist](https://packagist.org/packages/damodar-bhattarai/settings)[ RSS](/packages/damodar-bhattarai-settings/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (4)DependenciesVersions (8)Used By (0)

Settings (Laravel Settings Package) (DB Based)
==============================================

[](#settings-laravel-settings-package-db-based)

Store general settings like website name, logo url, contacts in the database easily. Everything is cached, so no extra query is done. You can also get fresh values from the database directly if you need.

Installation
------------

[](#installation)

Install the package via composer

```
composer require damodar-bhattarai/settings
```

Publish the migrations using the following command

```
php artisan vendor:publish --provider="DamodarBhattarai\Settings\SettingsServiceProvider"
```

Migrate the database

```
php artisan migrate
```

I have also added seeder for some general settings a website needs. Seed the database using command:

```
php artisan db:seed --class=SettingsSeeder

```

Usage/Examples
--------------

[](#usageexamples)

To store settings on database

```
settings()->set('key','value');

```

You can also set multiple settings at once

```
settings()->set([
        'key1'=>'value1',
        'key2'=>'value2',
        'key3'=>'value3'
    ]);

```

You can retrieve the settings from cache using any command below

```
settings('key');

settings()->get('key');

```

You can provide default value to key if that key doesn't exist

```
settings('key','default');  //returns default
settings()->get('key','default');  //returns default

```

Want the settings directly from database? You can do it,

```
settings('key','default',true);
settings()->get('key','default',true);

```

Getting all the settings stored on database

```
settings()->getAll();

```

Lets see some examples:

set "site\_name" as "StillAlive"

```
settings()->set('site_name','StillAlive');

```

get "site\_name" value

```
settings('site_name'); //outputs StillAlive

```

set multiple settings

```
settings()->set([
    'site_name'=>'StillAlive',
    'email'=>'info@bdamodar.com.np'
    'footer_text'=>'Copyright &copy;',
]);

```

You can use the settings on blade as

```
{{ settings('site_name') }}
{{ settings('site_name','default value' )}}

```

Or, if you have html stored on settings

```
{!! settings('footer_text') !!}
{!! settings('footer_text',Copyright Date('Y')) !!}

```

New on v1.0.1 ( short\_text helper)
-----------------------------------

[](#new-on-v101--short_text-helper)

short\_text eliminates all the html entities including
 so you get clean text from the html provided.

##### short\_text($text, $length = 30, $read\_more = false, $link = false, $style = '')

[](#short_texttext-length--30-read_more--false-link--false-style--)

where, **$text** is html (like from rich text editors)

**$length** is character limit

**$read\_more** is boolean which helps to show or hide read more link

**$link** is the link to the above read\_more link

**$style** can be used to add styles and classes like ($style='style="color:blue;" class="font-weight-bold"';)

\##example

```
{{ short_text($post->description,100,true,route('post.show',$post->id),'class="text-red-500"') }}

```

Finally, If you have changed something directly on database, Don't forget to clear the cache.

```
php artisan cache:clear

```

License
-------

[](#license)

[MIT](https://choosealicense.com/licenses/mit/)

Feedback
--------

[](#feedback)

If you have any feedback, please reach out at  or submit a pull request here.

Authors
-------

[](#authors)

- [@damodar-bhattarai](https://www.github.com/damodar-bhattarai)

Badges
------

[](#badges)

[![MIT License](https://camo.githubusercontent.com/784362b26e4b3546254f1893e778ba64616e362bd6ac791991d2c9e880a3a64e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4d49542d677265656e2e737667)](https://choosealicense.com/licenses/mit/)

###  Health Score

38

—

LowBetter than 85% of packages

Maintenance52

Moderate activity, may be stable

Popularity28

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity51

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 95.5% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~158 days

Recently: every ~210 days

Total

7

Last Release

333d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/9e37a956809c0468f2a0cb69ec9a9a2661588c147640e0e36861b27d842e4574?d=identicon)[damodar-bhattarai](/maintainers/damodar-bhattarai)

---

Top Contributors

[![damodar-bhattarai](https://avatars.githubusercontent.com/u/33388995?v=4)](https://github.com/damodar-bhattarai "damodar-bhattarai (21 commits)")[![StyleCIBot](https://avatars.githubusercontent.com/u/11048387?v=4)](https://github.com/StyleCIBot "StyleCIBot (1 commits)")

---

Tags

laravelsettingsstore

### Embed Badge

![Health badge](/badges/damodar-bhattarai-settings/health.svg)

```
[![Health](https://phpackages.com/badges/damodar-bhattarai-settings/health.svg)](https://phpackages.com/packages/damodar-bhattarai-settings)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
