• Stars
    star
    1,232
  • Rank 38,102 (Top 0.8 %)
  • Language
    PHP
  • License
    MIT License
  • Created over 5 years ago
  • Updated 3 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A Laravel package for multilingual models

Introduction

Latest Version MIT License Offset Earth Larabelles

GitHub Workflow Status StyleCI Codecov Coverage Total Downloads GitBook

laravel-translatable socialcard

If you want to store translations of your models into the database, this package is for you.

This is a Laravel package for translatable models. Its goal is to remove the complexity in retrieving and storing multilingual model instances. With this package you write less code, as the translations are being fetched/saved when you fetch/save your instance.

The full documentation can be found at GitBook.

Installation

composer require astrotomic/laravel-translatable

Quick Example

Getting translated attributes

$post = Post::first();
echo $post->translate('en')->title; // My first post

App::setLocale('en');
echo $post->title; // My first post

App::setLocale('de');
echo $post->title; // Mein erster Post

Saving translated attributes

$post = Post::first();
echo $post->translate('en')->title; // My first post

$post->translate('en')->title = 'My cool post';
$post->save();

$post = Post::first();
echo $post->translate('en')->title; // My cool post

Filling multiple translations

$data = [
  'author' => 'Gummibeer',
  'en' => ['title' => 'My first post'],
  'fr' => ['title' => 'Mon premier post'],
];
$post = Post::create($data);

echo $post->translate('fr')->title; // Mon premier post

Tutorials

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details. You could also be interested in CODE OF CONDUCT.

Security

If you discover any security related issues, please check SECURITY for steps to report it.

Credits

Versions

Package Laravel PHP
v11.12 - v11.12 8.* / 9.* / 10.* ^8.0
v11.10 - v11.11 8.* / 9.* ^8.0
v11.6 - v11.9 5.8.* / 6.* / 7.* / 8.* >=7.2
v11.4 - v11.5 5.6.* / 5.7.* / 5.8.* / 6.* >=7.1.3
v11.0 - v11.3 5.6.* / 5.7.* / 5.8.* >=7.1.3

Treeware

You're free to use this package, but if it makes it to your production environment I would highly appreciate you buying the world a tree.

Itโ€™s now common knowledge that one of the best tools to tackle the climate crisis and keep our temperatures from rising above 1.5C is to plant trees. If you contribute to my forest youโ€™ll be creating employment for local families and restoring wildlife habitats.

You can buy trees at offset.earth/treeware

Read more about Treeware at treeware.earth

More Repositories

1

ignition-stackoverflow

An Ignition tab that fetches StackOverflow questions and provides a searchbar.
PHP
78
star
2

opendor.me

PHP
75
star
3

php-open-graph

This package provides a fluent PHP OOP builder for Open Graph protocol.
PHP
59
star
4

laravel-vcard

A fluent builder class for vCard files.
PHP
46
star
5

stancy

This package aims to provide the most common and flexible CMS features to your Laravel project.
PHP
36
star
6

laravel-tmdb

Interact with TMDB data in your Laravel application.
PHP
35
star
7

php-deepface

A PHP adapter for the python deepface framework.
PHP
34
star
8

laravel-dns

A Laravel wrapper for spatie/dns. Allows to query and validate DNS records.
PHP
31
star
9

laravel-cachable-attributes

Allows to cache attribute accessor values in an easy way.
PHP
31
star
10

php-conditional-proxy

This package provides a trait and class to allow calling methods based on a condition without breaking the method chain.
PHP
31
star
11

php-twemoji

Easily generate Twemoji URLs
PHP
31
star
12

laravel-unavatar

This package provides a Laravel wrapper for unavatar.
PHP
26
star
13

laravel-webmentions

A simple client to retrieve webmentions for your pages.
PHP
21
star
14

phpunit-assertions

This package provides a set of common PHPUnit custom assertions.
PHP
18
star
15

laravel-eloquent-uuid

PHP
13
star
16

nova-optional

PHP
10
star
17

instagram-parser

Parses data from Instagram without API access.
PHP
10
star
18

laravel-monolog-config

This package provides a simple way to configure monolog in laravel.
PHP
10
star
19

laravel-guzzle

This is a simple wrapper for Laravel around guzzlehttp/guzzle.
PHP
9
star
20

laravel-medialibrary-hls

PHP
9
star
21

countdown-gif

PHP
9
star
22

laravel-github-sponsors

Retrieve the GitHub Sponsors of a given user/organization.
PHP
8
star
23

laravel-fileable

๐Ÿšง
PHP
8
star
24

laravel-auth-recovery-codes

PHP
8
star
25

steam-sdk

PHP
7
star
26

laravel-weserv-images

A fluent URL generator for images.weserv.nl with Laravel bindings.
PHP
7
star
27

php-unavatar

This package provides a PHP OOP builder for unavatar.
PHP
7
star
28

php-weserv-images

A fluent URL generator for images.weserv.nl
PHP
7
star
29

laravel-linfo

This is a Laravel Wrapper for the linfo package from jrgp
PHP
6
star
30

laravel-translation

A Laravel 5 package that implements the Symfony Po-Translation lib.
PHP
6
star
31

laravel-imgix

Laravel bindings and facade to generate imgix URLs and support for multiple sources.
PHP
6
star
32

laravel-transaction-proxy

PHP
5
star
33

notifynder-documentation

The documentation for the laravel notifynder package.
PHP
5
star
34

astrotomic.info

Astrotomic website/landingpage
PHP
5
star
35

pest-plugin-laravel-snapshots

This package adds snapshot testing capabilities to Laravel HTTP tests with Pest.
PHP
5
star
36

laravel-dashboard-citybikes-tile

A Citybikes tile for Laravel Dashboard
PHP
5
star
37

ecologi-sdk

PHP
5
star
38

tmdb-sdk

PHP
4
star
39

psr-8

This repository holds all interfaces/classes/traits related to PSR-8.
PHP
4
star
40

php-path

4
star
41

laravel-mime

This package provides Laravel service bindings for symfony/mime.
PHP
4
star
42

notifynder-sender-redis

Redis Sender for the Notifynder package.
PHP
4
star
43

tailwindcss-nutella

JavaScript
4
star
44

laravel-dashboard-pingping-tile

A tile to display the status of PingPing Monitors
PHP
4
star
45

laravel-backuplay

PHP
3
star
46

laravel-hug

๐Ÿšง Share some love across your models.
PHP
3
star
47

graphql-query-builder

his package is an opinionated GraphQL Query Builder.
PHP
3
star
48

laravel-ecologi

PHP
3
star
49

iso639

A PHP library providing ISO 639-1 data.
PHP
3
star
50

tailwind-programming-language-colors

This plugin adds the programming language colours to the Tailwind colour palette.
JavaScript
3
star
51

tailwind-astrotomic-colors

JavaScript
3
star
52

vladhog-sdk

PHP
3
star
53

git-author

Creates GitHub author by username
HTML
3
star
54

notifynder-sender-nexmo

Nexmo Sender for the Notifynder package.
PHP
2
star
55

notifynder-sender-twilio

Twilio Sender for the Notifynder package.
PHP
2
star
56

statamic-webmentions

PHP
2
star
57

ecologist

PHP
2
star
58

notifynder-sender-messagebird

MessageBird Sender for the Notifynder package.
PHP
2
star
59

github-default-branch-rename

PHP
2
star
60

og.opendor.me

JavaScript
2
star
61

notifynder-sender-email

Email Sender for the Notifynder package.
PHP
2
star
62

notifynder-sender-slack

Slack Sender for the Notifynder package.
PHP
2
star
63

sourcebans-sdk

PHP
2
star
64

php-ufraw

PHP
1
star
65

discord-bot

JavaScript
1
star
66

ignition-github

Vue
1
star
67

art

Astrotomic styleguide and graphics.
Nunjucks
1
star
68

notifynder-abstract-sms

This is the abstract SMS package for all Notifynder SMS senders.
PHP
1
star
69

discord-sdk

PHP
1
star
70

fog-trade-sdk

PHP
1
star
71

dnd-converter

HTML
1
star
72

notifynder-abstract-call

This is the abstract Call package for all Notifynder Call senders.
PHP
1
star
73

stancy-laravel-demo

Laravel demo app for Stancy package
PHP
1
star
74

.github

JavaScript
1
star
75

opendor-og-image

1
star
76

notifynder-demo

The demo page for the Notifynder Package - https://github.com/fenos/Notifynder
PHP
1
star