{"id":93,"date":"2011-07-02T16:35:02","date_gmt":"2011-07-02T07:35:02","guid":{"rendered":"http:\/\/www.whoocus.com\/blog\/wordpress\/?p=93"},"modified":"2011-07-02T16:35:02","modified_gmt":"2011-07-02T07:35:02","slug":"sfmelodyplugin%e3%82%92%e8%a9%a6%e3%81%99","status":"publish","type":"post","link":"https:\/\/www.blowfish.co.jp\/?p=93","title":{"rendered":"sfMelodyPlugin\u3092\u8a66\u3059 \u305d\u306e1"},"content":{"rendered":"<p><strong><span style=\"color: #ff0000;\">\u203b\u6ce8\u610f \u3053\u306e\u8a18\u4e8b\u306f\u73fe\u5728\u8abf\u67fb\u3092\u9032\u3081\u306a\u304c\u3089\u8a18\u8ff0\u3057\u3066\u3044\u307e\u3059\u306e\u3067\u3001\u5b8c\u5168\u306a\u60c5\u5831\u3067\u306f\u3042\u308a\u307e\u305b\u3093\u3002<\/span><\/strong><\/p>\n<p>Symfony1.4 \u3067\u9023\u643a\u3057\u3088\u3046\u3068\u601d\u3063\u3066\u305f\u3069\u308a\u7740\u3044\u305f <a href=\"http:\/\/www.symfony-project.org\/plugins\/sfMelodyPlugin\">sfMelodyPlugin<\/a>\u3002<br \/>\nSymfony1.4 \u306e\u4f7f\u7528\u65b9\u6cd5\u3082\u9593\u3005\u306a\u3089\u306a\u3044\u307e\u307e\u306bplugins\/sfMelodyPlugin \u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306b\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3002\u4e2d\u306b\u3042\u308b\u82f1\u8a9e\u306eREADME.txt \u3092\u8aad\u3093\u3067\u307f\u308b\u3002<br \/>\n\u4e00\u822c\u7684\u306b\u306f\u4e0b\u8a18\u306e\u30b3\u30de\u30f3\u30c9\u3067\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3067\u304d\u308b\u3088\u3046\u3060\u304c\u3001PEAR\u304c\u52b9\u304b\u306a\u3044\u74b0\u5883\u306a\u306e\u3067\u4e00\u5f0f\u914d\u7f6e\u3002<\/p>\n<p>[code]<br \/>\n$ php symfony plugin:install sfMelodyPlugin<br \/>\n[\/code]<\/p>\n<p>\u30ad\u30e3\u30c3\u30b7\u30e5\u3092\u30af\u30ea\u30a2\u3057\u3066\u3001<\/p>\n<p>[code]<br \/>\n$ php symfony cc<br \/>\n[\/code]<\/p>\n<p>sfMelody \u3092 settings.yml \u306b\u8a2d\u5b9a\u3059\u308b\u3002<br \/>\n\u3061\u306a\u307f\u306b\u3001Doctrine\u4f7f\u7528\u306e\u5834\u5408\u3001<a href=\"http:\/\/www.symfony-project.org\/plugins\/sfDoctrineOAuthPlugin\">sfDoctrineOAuthPlugin <\/a>\u3068 <a href=\"http:\/\/www.symfony-project.org\/plugins\/sfDoctrineGuardPlugin\">sfDoctrineGuardPlugin<\/a> \u304c\u5fc5\u8981\u3089\u3057\u3044\u3002<br \/>\nsfMelody \u3068\u540c\u69d8\u306b plugins\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306b\u914d\u7f6e\u3057\u305f\u3002<\/p>\n<p>[code]<br \/>\nall:<br \/>\n  .settings:<br \/>\n    enabled_modules: [default, sfGuardAuth, sfMelody]<br \/>\n[\/code]<\/p>\n<p>\u9069\u7528\u3059\u308b\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306b\u3042\u308bmyUser.class.php \u306e\u7d99\u627f\u5143\u3092\u5909\u66f4\u3059\u308b\u3002<br \/>\napps\/my-app\/lib\/myUser.class.php:<\/p>\n<p>[code]<br \/>\n  class myUser extends sfMelodyUser<br \/>\n  \/\/class myUser extends sfBasicSecurityUser<br \/>\n  {<br \/>\n  }<br \/>\n[\/code]<\/p>\n<p>app.yml \u3092\u8a2d\u5b9a\u3059\u308b\u3002<\/p>\n<p>[code]<br \/>\nall:<br \/>\n  melody:<br \/>\n    create_user: false            # \u5bfe\u8c61\u30b5\u30fc\u30d3\u30b9(twitter\u7b49)\u306b\u63a5\u7d9a\u3057\u305f\u6642\u306b\u30ed\u30b0\u30aa\u30f3\u3067\u304d\u306a\u3044\u5834\u5408\u65b0\u898f\u4f5c\u6210\u3059\u308b\u304b\u3069\u3046\u304b<br \/>\n    redirect_register: false      # \u767b\u9332\u753b\u9762\u306b\u30ea\u30c0\u30a4\u30ec\u30af\u30c8\u3059\u308b\u304b\u3069\u3046\u304b<br \/>\n    twitter:                      #name<br \/>\n      key:  my_service_key        # twitter \u3067\u767a\u884c\u3055\u308c\u305f\u30b3\u30f3\u30b7\u30e5\u30fc\u30de\u30fc\u30fb\u30ad\u30fc(API key)\u3092\u8a18\u8ff0<br \/>\n      secret: my_secret_key       # twitter \u3067\u767a\u884c\u3055\u308c\u305f\u30b3\u30f3\u30b7\u30e5\u30fc\u30de\u30fc\u30fb\u30b7\u30fc\u30af\u30ec\u30c3\u30c8\u3092\u8a18\u8ff0<br \/>\n      callback: @mymodule_index   # \u30b3\u30fc\u30eb\u30d0\u30c3\u30afURL\u3092\u8a18\u8ff0<\/p>\n<p>      #\u30aa\u30d7\u30b7\u30e7\u30f3 (\u2193\u2193\u2193\u2193\u2193\u8abf\u67fb\u4e2d\u2193\u2193\u2193\u2193\u2193\u2193)<br \/>\n      user:                       # to create an user<br \/>\n        field_1:<br \/>\n          call: xx<br \/>\n          call_parameters: [x, x, x]<br \/>\n          path: xx.xy.zz<br \/>\n          prefix: xx_<br \/>\n          suffix: _xx<br \/>\n          key: false<br \/>\n        &#8230;<\/p>\n<p>      provider: twitter          #\u5bfe\u8c61\u30b5\u30fc\u30d3\u30b9\u540d (\u4ed6google \/ facebook\u7b49)<br \/>\n      request_token_url: https:\/\/api.twitter.com\/oauth\/request_token  # \u30ea\u30af\u30a8\u30b9\u30c8\u30fb\u30c8\u30fc\u30af\u30f3URL<br \/>\n      request_auth_url: https:\/\/api.twitter.com\/oauth\/authorize #URL\u3092\u8a31\u53ef\u3059\u308b<br \/>\n      access_token_url: https:\/\/api.twitter.com\/oauth\/access_token  #\u30a2\u30af\u30bb\u30b9\u30fb\u30c8\u30fc\u30af\u30f3URL<\/p>\n<p>      # (\u2193\u2193\u2193\u2193\u2193\u8abf\u67fb\u4e2d\u2193\u2193\u2193\u2193\u2193\u2193)<br \/>\n      namespaces:                 # namespaces are used to make some api calls &#8211; see namespace Section<br \/>\n        ns1: http:\/\/my.name.space<br \/>\n        &#8230;<br \/>\n      aliases:                    # Alias is an easy way to simplify api calls<br \/>\n        me: my\/alias<br \/>\n        &#8230;<br \/>\n      auth_parameters:<br \/>\n        param1: value<br \/>\n      call_parameters:<br \/>\n        param1: value<br \/>\n      access_parameters:<br \/>\n        param1: value<br \/>\n      output_format: json<br \/>\n      create_user: true<br \/>\n      redirect_register: false<\/p>\n<p>      #optional only for OAuth 1<br \/>\n      request_parameters:<br \/>\n        param1: value<br \/>\n      request_token_url: https:\/\/api.twitter.com\/oauth\/request_token  # \u30ea\u30af\u30a8\u30b9\u30c8\u30fb\u30c8\u30fc\u30af\u30f3URL<br \/>\n[\/code]<\/p>\n<p>\u307e\u3060\u4f55\u3082\u308f\u304b\u3089\u306a\u3044\u307e\u307e\u3001\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u5b9f\u884c\u3057\u3066\u307f\u308b\u3002\u547c\u3073\u51fa\u3059\u3079\u304d actions.class \u306b\u63a5\u7d9a\u306e\u30a2\u30af\u30b7\u30e7\u30f3\u30e1\u30bd\u30c3\u30c9(executeIndex)\u3068Callback\u3092\u53d7\u3051\u308b\u30a2\u30af\u30b7\u30e7\u30f3\u30e1\u30bd\u30c3\u30c9(executeShow)\u3092\u8a18\u8ff0\u3002<\/p>\n<p>[php]<br \/>\n  public function executeIndex(sfWebRequest $request)<br \/>\n  {<br \/>\n  \t$this-&gt;getUser()-&gt;connect(&#8216;twitter&#8217;);  \/\/name\u3067\u6307\u5b9a\u3057\u305f\u540d\u524d<br \/>\n  }<br \/>\n  public function executeShow(sfWebRequest $request)<br \/>\n  {<br \/>\n  \t$this-&gt;me = $this-&gt;getUser()-&gt;getMelody(&#8216;twitter&#8217;)-&gt;getMe();<br \/>\n  }<br \/>\n[\/php]<\/p>\n<p>\u305d\u308c\u306b\u4f34\u3044routing.yml \u3082\u8a2d\u5b9a\u3059\u308b\u3002<\/p>\n<p>[code]<br \/>\ntwitter_callback:<br \/>\n  url:   \/:module<br \/>\n  param: { action: show }<br \/>\n[\/code]<\/p>\n<p>\u3059\u308b\u3068\u3001\u4f55\u3084\u3089 sfOAuth1 \u304c\u898b\u3064\u304b\u3089\u306a\u3044\u3068\u306e\u30a8\u30e9\u30fc\u3002\u5b9f\u969b\u306e\u30d5\u30a1\u30a4\u30eb\u304c sfDoctrineOAuthPlugin \u306b\u7121\u3044\u306e\u304b\u306a\u3068\u4e88\u6e2c\u3057\u305f\u3089\u3084\u306f\u308a\u7121\u3044\u3002\u3069\u3046\u3084\u3089 <a href=\"https:\/\/github.com\/chok\/OAuthBase\">OAuthBase<\/a> \u306e\u30e2\u30b8\u30e5\u30fc\u30eb\u304c\u5225\u9014\u5fc5\u8981\u306a\u3088\u3046\u3060\u3002\u6025\u3044\u3067\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3057\u305f\u3089\u3053\u306e\u30a8\u30e9\u30fc\u306f\u7121\u304f\u306a\u3063\u305f\u3002<\/p>\n<p>\u3057\u304b\u3057\u6b21\u306e\u30a8\u30e9\u30fc<\/p>\n<p>[code]<br \/>\nFatal error: Call to undefined function curl_init()<br \/>\n[\/code]<\/p>\n<p>\u3069\u3046\u3084\u3089php\u306b\u3066\u3001cURL\u304c\u6709\u52b9\u306b\u306a\u3063\u3066\u3044\u306a\u3044\u6a21\u69d8\u3002<br \/>\nphp.ini \u3067\u540c\u30e2\u30b8\u30e5\u30fc\u30eb\u3092\u6709\u52b9\u306b\u3057\u3066Apache\u306e\u518d\u8d77\u52d5\u3057\u305f\u3089twitter\u30da\u30fc\u30b8\u306b\u30ea\u30c0\u30a4\u30ec\u30af\u30c8\u3067\u304d\u307e\u3057\u305f\u3002<\/p>\n<p><a href=\"http:\/\/49.212.148.32\/blog\/wp-content\/uploads\/2011\/07\/twitter_callback.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-122\" title=\"twitter_callback\" src=\"http:\/\/49.212.148.32\/blog\/wp-content\/uploads\/2011\/07\/twitter_callback.png\" alt=\"\" width=\"661\" height=\"396\" \/><\/a><\/p>\n<p>\u30a8\u30e9\u30fc\u753b\u9762\u306a\u306e\u3067\u9023\u643a\u3068\u307e\u3067\u306f\u3044\u3051\u307e\u305b\u3093\u3067\u3057\u305f\u3002<br \/>\n\u307e\u3060\u307e\u3060\u3001\u5b8c\u5168\u306a\u9023\u643a\u306b\u306f\u7a0b\u9060\u3044\u306e\u3067\u3059\u304c\u3061\u3087\u3063\u3068\u611f\u52d5\u3067\u3059\u3002<\/p>\n<p>\u7d9a\u304d\u306f\u5f8c\u65e5\u30fb\u30fb\u30fb\u3002<\/p>\n<p>\u25a0\u53c2\u8003\u30b5\u30a4\u30c8<br \/>\n<a href=\"http:\/\/symfohub.com\/repo\/sfMelodyPlugin\/documentation\">Symfohub<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u203b\u6ce8\u610f \u3053\u306e\u8a18\u4e8b\u306f\u73fe\u5728\u8abf\u67fb\u3092\u9032\u3081\u306a\u304c\u3089\u8a18\u8ff0\u3057\u3066\u3044\u307e\u3059\u306e\u3067\u3001\u5b8c\u5168\u306a\u60c5\u5831\u3067\u306f\u3042\u308a\u307e\u305b\u3093\u3002 Symfony1.4 \u3067\u9023\u643a\u3057\u3088\u3046\u3068\u601d\u3063\u3066\u305f\u3069\u308a\u7740\u3044\u305f sfMelodyPlugin\u3002 Symfony1.4 \u306e\u4f7f\u7528\u65b9\u6cd5\u3082\u9593\u3005\u306a\u3089\u306a\u3044 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"saved_in_kubio":false,"footnotes":""},"categories":[13,15,16,4],"tags":[],"class_list":["post-93","post","type-post","status-publish","format-standard","hentry","category-php","category-symfony","category-twitter","category-tech"],"_links":{"self":[{"href":"https:\/\/www.blowfish.co.jp\/index.php?rest_route=\/wp\/v2\/posts\/93","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.blowfish.co.jp\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.blowfish.co.jp\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.blowfish.co.jp\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.blowfish.co.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=93"}],"version-history":[{"count":0,"href":"https:\/\/www.blowfish.co.jp\/index.php?rest_route=\/wp\/v2\/posts\/93\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.blowfish.co.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=93"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.blowfish.co.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=93"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.blowfish.co.jp\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=93"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}