• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

unicodeveloper/laravel-hackathon-starter: A hackathon/MVP boilerplate for larave ...

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称(OpenSource Name):

unicodeveloper/laravel-hackathon-starter

开源软件地址(OpenSource Url):

https://github.com/unicodeveloper/laravel-hackathon-starter

开源编程语言(OpenSource Language):

PHP 62.1%

开源软件介绍(OpenSource Introduction):

Laravel Hackathon Starter - SUSUMU 進

Build Status Quality Score

If you have attended any hackathons in the past, then you know how much time it takes to get a project started: decide on what to build, pick a programming language, pick a web framework, pick a CSS framework. A while later, you might have an initial project up on GitHub and only then can other team members start contributing. Or how about doing something as simple as Sign in with Facebook authentication? You can spend hours on it if you are not familiar with how OAuth 2.0 works.

Even if you are not using this for a hackathon, Laravel Hackathon Starter is sure to save any developer hours or even days of development time and can serve as a learning guide for web developers.

Laravel is a web application framework with expressive, elegant syntax. Laravel attempts to take the pain out of development by easing common tasks used in the majority of web projects, such as authentication, routing, sessions, queueing, and caching.

Laravel Hackathon Starter is a boilerplate application developed with Laravel 5.2 to keep you ahead in hackathons.

Modern Theme

API Examples

Table of Contents

Features

  • Local Authentication using Email and Password
  • OAuth 1.0a Authentication via Twitter
  • OAuth 2.0 Authentication via Facebook, Google, GitHub, LinkedIn, Instagram
  • Flash notifications
  • MVC Project Structure
  • Bootstrap 3
  • Contact Form (powered by Mailgun, Sendgrid or Mandrill)
  • Account Management
  • Gravatar
  • Profile Details
  • Change Password
  • Forgot Password
  • Reset Password
  • Delete Account
  • CSRF protection
  • API Examples: Facebook, Foursquare, Last.fm, Tumblr, Twitter, Stripe, LinkedIn and more.
  • Automatic Documentation

Prerequisites

  • Mysql or Postgresql
  • PHP 5.4+
  • Command Line Tools
  •  Mac OS X: Xcode (or OS X 10.9+: xcode-select --install)
  •  Windows: Visual Studio
  •  Ubuntu /  Linux Mint: sudo apt-get install build-essential
  •  Fedora: sudo dnf groupinstall "Development Tools"
  •  OpenSUSE: sudo zypper install --type pattern devel_basis
  •  Optic: npm install -g @useoptic/cli (needed for automatic documentation)

Note: If you are new to Laravel, I recommend to watch Laravel From Scratch screencast by Jeffery Way that teaches Laravel 5 from scratch. Alternatively, here is another great tutorial for building a project management app for beginners/intermediate developers - How to build a project management app in Laravel 5.

Getting Started

Via Cloning The Repository:

# Get the project
git clone https://github.com/unicodeveloper/laravel-hackathon-starter.git hackathon-starter-pack

# Change directory
cd hackathon-starter-pack

# Copy .env.example to .env
cp .env.example .env

# Create a database (with mysql or postgresql)
# And update .env file with database credentials
# DB_CONNECTION=mysql
# DB_HOST=127.0.0.1
# DB_DATABASE=laravelhackathon
# DB_USERNAME=root
# DB_PASSWORD=root

# Install Composer dependencies
composer install 

# Generate application secure key (in .env file)
php artisan key:generate

# Generate application secure key (in .env file)
php artisan key:generate

php artisan serve

Via The Installer:

First, download the Laravel Hackathon Starter Pack Installer using Composer:

composer global require "unicodeveloper/hackathon-installer"

Make sure to place the ~/.composer/vendor/bin directory (or the equivalent directory for your OS) in your PATH so the larathon executable can be located by your system.

Once installed, the larathon new command will create a fresh Laravel Hackathon Starter Pack installation in the directory you specify. For instance, larathon new mvp will create a directory named mvp containing a fresh Laravel Hackathon Starter Pack installation with all of it's dependencies already installed. This method of installation is much faster than installing via Composer:

larathon new mvp

Via Composer Create-Project

Alternatively, you may also install Laravel Hackathon Starter Pack by issuing the Composer create-project command in your terminal:

composer create-project --prefer-dist unicodeveloper/laravel-hackathon-starter hotel

This starter pack includes the following APIs. You will need to obtain appropriate credentials like Client ID, zClient secret, API key, or Username & Password by going through each provider and generate new credentials.

  • Cloudder
  • Twitter
  • Twillo
  • Github
  • Slack
  • Socialite Providers
  • Socialite LinkedIn

Obtaining API Keys

  • Visit Google Cloud Console
  • Click on the Create Project button
  • Enter Project Name, then click on Create button
  • Then click on APIs & auth in the sidebar and select API tab
  • Click on Google+ API under Social APIs, then click Enable API
  • Next, under APIs & auth in the sidebar click on Credentials tab
  • Click on Create new Client ID button
  • Select Web Application and click on Configure Consent Screen
  • Fill out the required fields then click on Save
  • In the Create Client ID modal dialog:
  • Application Type: Web Application
  • Authorized Javascript origins: http://localhost:3000
  • Authorized redirect URI: http://localhost:3000/auth/google/callback
  • Click on Create Client ID button
  • Copy and paste Client ID and Client secret keys into .env

Note: When you ready to deploy to production don't forget to add your new url to Authorized Javascript origins and Authorized redirect URI, e.g. http://my-awesome-app.herokuapp.com and http://my-awesome-app.herokuapp.com/auth/google/callback respectively. The same goes for other providers.


  • Visit Facebook Developers
  • Click My Apps, then select *Add a New App from the dropdown menu
  • Select Website platform and enter a new name for your app
  • Click on the Create New Facebook App ID button
  • Choose a Category that best describes your app
  • Click on Create App ID button
  • In the upper right corner click on Skip Quick Star
  • Copy and paste App ID and App Secret keys into .env
  • Note: App ID is clientID, App Secret is clientSecret
  • Click on the Settings tab in the left nav, then click on + Add Platform
  • Select Website
  • Enter http://localhost:3000 under Site URL

Note: After a successful sign in with Facebook, a user will be redirected back to home page with appended hash #_=_ in the URL. It is not a bug. See this Stack Overflow discussion for ways to handle it.


  • Go to Account Settings
  • Select Applications from the sidebar
  • Then inside Developer applications click on Register new application
  • Enter Application Name and Homepage URL
  • For Authorization Callback URL: http://localhost:3000/auth/github/callback
  • Click Register application
  • Now copy and paste Client ID and Client Secret keys into .env file

  • Sign in at https://apps.twitter.com/
  • Click Create a new application
  • Enter your application name, website and description
  • For Callback URL: http://127.0.0.1:3000/auth/twitter/callback
  • Go to Settings tab
  • Under Application Type select Read and Write access
  • Check the box Allow this application to be used to Sign in with Twitter
  • Click Update this Twitter's applications settings
  • Copy and paste Consumer Key and Consumer Secret keys into .env file

  • Sign in at LinkedIn Developer Network
  • From the account name dropdown menu select API Keys
  • It may ask you to sign in once again
  • Click + Add New Application button
  • Fill out all the required fields
  • OAuth 2.0 Redirect URLs: http://localhost:3000/auth/linkedin/callback
  • JavaScript API Domains: http://localhost:3000
  • For Default Application Permissions make sure at least the following is checked:
  • r_basicprofile
  • Finish by clicking Add Application button
  • Copy and paste API Key and Secret Key keys into .env file
  • API Key is your clientID
  • Secret Key is your clientSecret

  • Sign up or log into your dashboard
  • Click on your profile and click on Account Settings
  • Then click on API Keys
  • Copy the Secret Key. and add this into .env file

  • Visit PayPal Developer
  • Log in to your PayPal account
  • Click Applications > Create App in the navigation bar
  • Enter Application Name, then click Create app
  • Copy and paste Client ID and Secret keys into .env file
  • App ID is client_id, App Secret is client_secret
  • Change host to api.paypal.com if you want to test against production and use the live credentials




  • Go to https://sendgrid.com/user/signup
  • Sign up and confirm your account via the activation email
  • Then enter your SendGrid Username and Password into .env file

  • Go to http://www.mailgun.com
  • Sign up and add your Domain Name
  • From the domain overview, copy and paste the default SMTP Login and Password into .env file

  • Go to http://mandrill.com
  • Sign up and add your Domain Name
  • From the dashboard, click on Get SMTP credentials
  • Copy and paste the default SMTP Login and Password into .env file

  • Go to https://test.bitgo.com/
  • Sign up for an account.
  • Once logged into the dashboard, go to the top right selector and click 'account settings'
  • Under the developers tab, create your access token and copy and paste it into .env file

  • Go to https://www.twilio.com/try-twilio
  • Sign up for an account.
  • Once logged into the dashboard, expand the link 'show api credentials'
  • Copy your Account Sid and Auth Token

run php artisan vendor:publish

Project Structure

Name Description
config/app.php Configuration for service providers and facades
config/auth.php Configuration for password resets
config/broadcasting.php Configuration for broadcasting
config/cache.php Configuration for cache generation and storage
config/cloudder.php Configuration for cloudinary
config/compile.php Configuration for compilation
config/database.php Configuration for database drivers
config/filesystems.php Configuration for different file systems
config/github.php Configuration for github API
config/mail.php Configuration for mails
config/queue.php Configuration for queue
config/services.php Configuration for several services like mailgun etc.
config/session.php Configuration for sessions
config/ttwitter.php Twitter API config file
config/twilio.php Twilio API config file
config/view.php Configuration for location of views and view cache
controllers/AccountController.php Controller for Account management
controllers/AviaryController.php Controller for Aviary API functionality
controllers/ClockworkController.php Controller for Clockwork API functionality
controllers/ContactController.php Controller for Contact page
controllers/Controller.php BaseController
controllers/GithubController.php Controller for Github API functionality
controllers/LastFmController.php Controller for LastFM API functionality
controllers/LobController.php Controller for Lob API functionality.
controllers/NytController.php Controller for New York Times API functionality
controllers/OauthController.php Controller for Oauthentication
controllers/PaypalController.php Controller for Paypal API functionality
controllers/SteamController.php Controller for Stream API functionality
controllers/StripeController.php Controller for Stripe API functionality
controllers/TwilioController.php Controller for Twilio API functionality
controllers/TwitterController.php Controller for Twitter API functionality
controllers/WebScrapingController.php Controller for Web Scraping.
controllers/YahooController.php Controller for Yahoo API functionality
controllers/user.js Controller for user account management.
models/User.php Model for User.
public/ Static assets (fonts, css, js, img).
public/css/main.css Main stylesheet for your app.
resources/views/account/ Templates for login, password reset, signup, profile.
views/api/ Templates for API Examples.
views/partials/alerts.blade.php Error, info and success flash notifications.
views/partials/navbar.blade.php Navbar partial template.
views/layouts**/master.blade.php Base template.
views/apidashboard.blade.php API dashboard template.
views/contact.blade.php Contact page template.
views/welcome.blade.php Home page template.
.travis.yml Travis CI integration.
.env.example Your API keys, tokens, passwords and database URI.
composer.json File for loading all php packages.
package.json File for loading all necessary node modules.
artisan File for enabling commands to run

List of Packages

Package Description
socialite Sign-in with Facebook, Twitter and Github
socialite providers Sign-in with LinkedIn, Instagram
cloudder Upload images to Cloudinary
laravel github Github API library
clockwork Clockwork SMS API library.
goutte Scrape web pages using jQuery-style syntax.
laravel framework PHP web framework
twitter Twitter API library
twilio Twilio API library
lob-php Lob API library
lastfm-api-wrapper Lastfm API library
phpunit PHP testing library
guzzlehttp Simplified HTTP Request library

Useful Tools and Resources

Recommended Design Resources

Recommended Laravel Libraries

Enabling Automatic Documentation

Using Optic, you can use your API like normal, automatically documenting changes in behavior. To enable this, you'll first need to download Optic.

    npm install -g @useoptic/cli

Once you've installed Optic, you can start documenting your requests by running api start. Running this command will create a proxied version of your api, available at localhost:4000 - now, you can use the API like normal here, and Optic will automatically notice differences in the documented behavior, allowing you to automatically create documentation as your API changes.

To view the current documentation of the api, run api spec at the root directory.

Useful Commands

    api start # use this to start monitoring your API
    api spec # use this to inspect the current documentation of your API
    api generate:oas # generates an OpenAPI specification for your currently documented API

For more information about Optic, check out the docs.

FAQ

Why do I get Token Mismatch Exception when submitting a form?

You need to add the following hidden input element to your form. This has been added in the existing codebase as part of the CSRF protection.

{!! csrf_field() !!}

I get a whoops error when I deploy my app, why?

Chances are you haven't generated the app key, so run php artisan key:generate. Chances are you haven't put your credentials in your .env file.

How It Works (mini guides)

This section is intended for giving you a detailed explanation about how a particular functionality works. Maybe you are just curious about how it works, or maybe you are lost and confused while reading the code, I hope it provides some guidance to you.


How do flash messages work in this project?

Flash messages allow you to display a message at the end of the request and access it on next request and only next request. For instance, on a failed login attempt, you would display an alert with some error message, but as soon as you refresh that page or visit a different page and come back to the login page, that error message will be gone. It is only displayed once. All flash messages are available in your views via laravel sessions.



鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap