Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/archtechx/laravel-tips
Laravel Code Tips
https://github.com/archtechx/laravel-tips
laravel
Last synced: 2 months ago
JSON representation
Laravel Code Tips
- Host: GitHub
- URL: https://github.com/archtechx/laravel-tips
- Owner: archtechx
- Created: 2021-03-31T13:54:10.000Z (almost 4 years ago)
- Default Branch: master
- Last Pushed: 2022-12-01T11:24:35.000Z (about 2 years ago)
- Last Synced: 2024-05-01T17:19:07.924Z (9 months ago)
- Topics: laravel
- Language: PHP
- Homepage: https://laravel-code.tips
- Size: 1.11 MB
- Stars: 78
- Watchers: 4
- Forks: 7
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Laravel Code Tips
This project is a simple Laravel application that uses:
- Ryan Chandler's [Orbit](https://github.com/ryangjchandler/orbit) package for storing data in markdown files,
- custom command for generating a static version of the website (this will later be extracted to a separate and more robust package),
- [Flipp](https://useflipp.com) for beautiful OpenGraph & Twitter Card previews,
- [Lars Klopstra](https://twitter.com/larsklopstra)'s amazing design skills. Thanks a ton for the design ❤️The live version can be found on [laravel-code.tips](https://laravel-code.tips) or if you like emojis, that's [💻🔥⚡️💡.y.at](https://💻🔥⚡️💡.y.at).
Definitely feel free to submit content; it can be a great way to promote your work (not that you can't submit others' tips, we accept all that are good!).
Right now all tips should be on Twitter, but later we'll make it easier to add them standalone as well. That said, it's best to share your work on your Twitter profile before adding it here, since we link back to your Twitter post & profile, which will help you grow an audience.
## Submitting tips
Open a PR adding a new file to `content/tips`. The file name should be a unique slug of the tip. The content should look like this:
```md
---
title: 'Use strict comparison'
tweet_id: '1272826452652810240'
thread_slug: laravel-clean-code-tactics
author_username: samuelstancl
images:
- 'https://pbs.twimg.com/media/Ean722QXgAENwmW.jpg'
created_at: 2021-04-06T16:07:36+00:00
slug: use-strict-comparison
---ALWAYS use strict comparison (=== and !==). If needed, cast things go the correct type before comparing. Better than weird == results
Also consider enabling strict types in your code. This will prevent passing variables of wrong data types to functions
```The `slug` matches the file name, the `author_username` is the Twitter handle of the tip author, `tweet_id` is the id of the tweet with the tip, and `images` is an array of images that should be shown between the heading and the content.'
**Make sure you also create a record in `content/users` for your Twitter handle** if your Author is not created yet. The tip's `author_username` needs to reference an Author model.
### Helper command
You can also use the `php artisan tweet:add` command to add content, just make sure that the tweet's "dependencies" (author and possibly thread) are in place.
## Local setup
If you'd like to seed the database with content, create a new Twitter application and set the `TWITTER_TOKEN` variable in `.env` to the Bearer token of the app. That said, you likely won't need this because all the default data is available in this repository already. So you only need to do this if you want to add a lot of tweets in bulk.
Otherwise, the project doesn't require any database, so you can just `git clone` it and open it in your browser, e.g. using Valet or `artisan serve`.
To generate the static HTML run `composer generate` and to preview it run `composer serve`.