Skip to content

Instantly share code, notes, and snippets.

@localdisk
localdisk / typetalk.php
Created February 8, 2014 10:56
typetalk api use php (guzzle)
<?php
/**
* 前準備
* 1.Composer をインストールする(https://getcomposer.org/doc/00-intro.md)
* 2.Guzzle をインストール
{
"require": {
"guzzle/guzzle": "dev-master"
}
<?php
/*
|--------------------------------------------------------------------------
| アプリケーションルート
|--------------------------------------------------------------------------
|
| このファイルでアプリケーションの全ルートを定義します。
| 方法は簡単です。対応するURIをLaravelに指定してください。
| そしてそのURIに対応する実行コードをクロージャーで指定します。
@localdisk
localdisk / User.php
Last active August 29, 2015 13:59
Laravel 4.1.26 で UserInterface が変更されたので以下のメソッドを実装する必要があります
<?php
class User extends Eloquent implements UserInterface, RemindableInterface {
// 新たに追加されたメソッドを実装すべし
/**
* Get the token value for the "remember me" session.
*
* @return string
*/
public function getRememberToken()
{
@localdisk
localdisk / AddRememberTokenToUsersTable.php
Last active August 29, 2015 13:59
Laravel 4.1.26 で users テーブルに remember_token カラムが必須になった
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class AddRememberTokenToUserTable extends Migration
{
/**
* Run the migrations.
@localdisk
localdisk / fontconfig.properties
Created May 8, 2014 00:33
fontconfig.properties. NetBeans では <JDKインストールディレクトリ>\jre\lib\fontconfig.properties にコピーする。
# special thanks
# http://www.02.246.ne.jp/~torutk/java/install/jdk7onwindows7.html
#
#
# Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
# ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
#
#
#
#
<?php
namespace Backlog;
use GuzzleHttp\Client;
class XmlRpcSample
{
protected $url;
protected $user;
@localdisk
localdisk / pdf.php
Created May 30, 2014 05:02
dompdf, mPDF
<?php
Route::get('dompdf', function()
{
// 前準備として load_font.php で描画に必要なフォントを読み込ませる。
define("DOMPDF_ENABLE_AUTOLOAD", false);
require_once base_path() . "/vendor/dompdf/dompdf/dompdf_config.inc.php";
$domPdf = new DOMPDF();
$domPdf->load_html(View::make('pdf'));
$domPdf->set_paper('A4');
@localdisk
localdisk / routes.php
Last active March 2, 2018 01:23
Laravel で簡易Webサーバー
<?php
Route::get('show', function()
{
$article = ['id' => 1, 'title' => "today's dialy", 'content' => "It's a sunny day."];
return Response::json($article);
});
Route::post('edit', function()
{
@localdisk
localdisk / routes.php
Created June 30, 2014 01:35
aws/aws-sdk-php-laravel で S3
<?php
Route::get('dir', function()
{
return View::make('dir');
});
Route::post('dir', function()
{
$v = Validator::make(Input::all(), ['name' => 'required']);
if ($v->fails()) {
@localdisk
localdisk / routes.php
Last active August 29, 2015 14:03
CakePHP の Router::parseExtensions っぽい動きを Laravel で考えてみた
<?php
Route::get('api/members{ext?}', function($ext = null)
{
if (is_null($ext)) {
$ext = 'view';
}
$ext = ltrim($ext, '.');
// ここはちょっと考える必要あるかも
// View の切り替えをしたい場合は View::make がいいかもしれません
return Response::$ext('test');