1
0
Fork 0
mirror of https://github.com/archtechx/laravel-tips.git synced 2025-12-12 05:14:04 +00:00
Laravel Code Tips https://laravel-code.tips
Find a file
Samuel Štancl 743056e14d php 7.4
2021-04-06 22:07:27 +02:00
app php 7.4 2021-04-06 22:07:27 +02:00
bootstrap initial commit 2021-04-06 18:27:18 +02:00
config initial commit 2021-04-06 18:27:18 +02:00
content initial commit 2021-04-06 18:27:18 +02:00
database initial commit 2021-04-06 18:27:18 +02:00
public branding 2021-04-06 21:14:55 +02:00
resources push 2021-04-06 22:03:15 +02:00
routes branding 2021-04-06 21:14:55 +02:00
storage initial commit 2021-04-06 18:27:18 +02:00
test initial commit 2021-04-06 18:27:18 +02:00
tests initial commit 2021-04-06 18:27:18 +02:00
.DS_Store branding 2021-04-06 21:14:55 +02:00
.editorconfig initial commit 2021-04-06 18:27:18 +02:00
.env.example initial commit 2021-04-06 18:27:18 +02:00
.gitattributes initial commit 2021-04-06 18:27:18 +02:00
.gitignore initial commit 2021-04-06 18:27:18 +02:00
.styleci.yml initial commit 2021-04-06 18:27:18 +02:00
artisan initial commit 2021-04-06 18:27:18 +02:00
composer.json branding 2021-04-06 21:14:55 +02:00
composer.lock initial commit 2021-04-06 18:27:18 +02:00
package-lock.json initial commit 2021-04-06 18:27:18 +02:00
package.json initial commit 2021-04-06 18:27:18 +02:00
phpunit.xml initial commit 2021-04-06 18:27:18 +02:00
README.md branding 2021-04-06 21:14:55 +02:00
server.php initial commit 2021-04-06 18:27:18 +02:00
tailwind.config.js initial commit 2021-04-06 18:27:18 +02:00
webpack.mix.js initial commit 2021-04-06 18:27:18 +02:00

Laravel Code Tips

This project is a simple Laravel application that uses:

  • Ryan Chandler's 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 for beautiful OpenGraph & Twitter Card previews

The live version can be found on laravel-code.tips or if you like emojis, that's 💻🔥💡.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.

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:

---
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.

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.